wanadev / yoga Goto Github PK
View Code? Open in Web Editor NEWConverts and optimizes images and 3D models
Home Page: https://wanadev.github.io/yoga/
License: Other
Converts and optimizes images and 3D models
Home Page: https://wanadev.github.io/yoga/
License: Other
The documentation says:
Building YOGA on Windows is not supported yet...
It could be nice to be able to use YOGA also on Windows!
Fill the texture with some kind of a debug image.
Draco is a powerful 3D library to compress 3D meshs: https://github.com/google/draco
What about Yoga compatibility? it could be a must to have.
There is no documentation on about how to build yoga and its dependencies.
FYI @flozz
Looking at zeux/meshoptimizer, we could use some optimization to assimp output geometries.
First do some tests with outputted geometries by YOGA, count the gains, and see if an integration as a lib is doable.
TODO-list:
In yoga/model/assimp.cpp
, extract_image_nodes
does not extract already embedded textures, they are ignored.
Keeping the very same convention than assimp, we could just fill imageNode
with:
auto imageNode = new ImageNode();
imageNode->path = "*1"; // Same convention, the 1 is the index of the textures in scene->mTextures
imageNode->bytes = /* extract bytes for scene->mTextures */;
imageNode->bytes_length = /* extract bytes length */;
Hello,
Any chance that Yoga includes multi-threading in the future ?
Overall performance seems pretty ok for small jpeg images, but for bigger ones it's really slow. One 75MB PNG (50Mpixels) took 30min to be converted, a 1.6MB PNG took 6min (but 33% saved, nice :).
Thanks
I'v tried to convert this model
artist.zip
And yoga raised this error:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 11: ordinal not in range(128)
Someone requested an option to keep metadata, so I open this issue to keep the information.
Questions that should be answered before:
When trying to optimize a glb file, application should return an optimized glb file.
When trying to optimize a glb file, application returns ValueError: Cannot resolve *13
and quits
yoga 1.3.1
blender 4.0.2
yoga model input.glb output.glb
Traceback (most recent call last):
File "C:\yoga\yogawin.py", line 6, in <module>
File "C:\yoga\yoga\__main__.py", line 25, in main
File "C:\yoga\concurrent\futures\_base.py", line 449, in result
File "C:\yoga\concurrent\futures\_base.py", line 401, in __get_result
File "C:\yoga\concurrent\futures\thread.py", line 58, in run
File "C:\yoga\yoga\model\__init__.py", line 251, in optimize
File "C:\yoga\yoga\model\helpers.py", line 135, in model_embed_images
ValueError: Cannot resolve *13
Maybe is something related to the blender exported file?
When doing a JPEG to JPEG optimization, we should never have an output image bigger than the input one.
Issue #43 must be resolved before this one
Related issue: flozz/yoga-image-optimizer#14
While embedding textures, an image referenced as ../../image.png
,
but present in root_path
directly won't be found.
This is a bit of a corner case, but it is useful for massively shrinking size further when dealing with scanned documents, especially text or some types of drawings: the ability to force the image to be in grayscale instead of RGB color. Oftentimes, document scanning apps (or people who do the scanning) may not think (or know) to encode that way, so the image is imperceptibly color even though perceptually it is grayscale. Converting to grayscale, for PNG and other lossless (or lossy) formats helps a ton... but doing it one image at a time with GIMP is a pain in the butt.
The same rule applies to alpha channels: sometimes there is one even if you don't necessarily need it, and it's extra weight that could be discarded (if the user knows what they're doing :)
In the installation doc, the instructions to get the git submodule are missing
Currently, yoga is not able to import a glb, as the check for the format wants to make sure that the filename ends with .glb
(and it does not because assimp reads memory).
Provide a pHint
argument to readFileFromMemory
: http://assimp.sourceforge.net/lib_html/class_assimp_1_1_importer.html#a9b3c5e8b1042702f449e84a95b3324f6
Generate it from lowercased the filename's extension (if any).
Hello,
I would like to know if you are planning to implement a Graphical User Interface for that software ?
Thanks
See @nekohayo issue on YOGA Image Optimizer → flozz/yoga-image-optimizer#20
How the ArchLinux package is compiled: Depend on assimp, because unable to install it following instruction. The assimp source code is still needed to compile yoga. So
python3 setup.py build_py
build_py is the only one that don't make error, and need this lib. The other documented build process don't work on Arch.
The files are then placed in the package dir using:
python setup.py install --root="${pkgdir}" --optimize=1 --skip-build
After installing the made package, it works fine with the user that build the package, but with other user, there is strangely the following error. could be due to some parts that are installed only for the compiling user during the build process?
Traceback (most recent call last):
File "/usr/bin/yoga", line 33, in <module>
sys.exit(load_entry_point('yoga==1.0.0', 'console_scripts', 'yoga')())
File "/usr/bin/yoga", line 25, in importlib_load_entry_point
return next(matches).load()
File "/usr/lib/python3.9/importlib/metadata.py", line 77, in load
module = import_module(match.group('module'))
File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 855, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/usr/lib/python3.9/site-packages/yoga/__init__.py", line 2, in <module>
from . import model # noqa
File "/usr/lib/python3.9/site-packages/yoga/model/__init__.py", line 174, in <module>
from .assimp import assimp_import_from_bytes, assimp_export_to_bytes
File "/usr/lib/python3.9/site-packages/yoga/model/assimp.py", line 6, in <module>
from ._assimp import lib, ffi
ModuleNotFoundError: No module named 'yoga.model._assimp'
Add choices for JPEG optimization:
Guetzli + MozJPEG
MozJPEG
MozJPEG lossless
Related issue: flozz/yoga-image-optimizer#15
Add inside documentation that python-setuptools
build-essential
and python-dev
are needed
Some files like FBX support lights and cameras, but these are not always useful.
Assimp supports an importer post-process called aiProcess_RemoveComponent
and configured with:
importer.SetPropertyInteger(AI_CONFIG_PP_RVC_FLAGS, aiComponent_CAMERAS | aiComponent_LIGHTS);
We might want yoga to remove everything but meshes/materials by default, and provide a --no-cleanup
option in the CLI and such.
Or if applied to different meshes.
Just installed Yoga and I cannot browse /var/www to open files in my local web dev directories. Is there a way for me to let Yoga see these directories? I have tried via 'Other locations' with no success.
Hello,
Because of the very long computation time for a lot of images (#28), a progression indicator (like a progress bar, or just a vague percentage) would be useful to estimate how long the processing will take.
What do you think about such a feature ? Any chance it gets implemented ?
Thank you
Hello,
I did convert a few files and notices a very high memory usage (often about 12 times the size of the original png), and in particular my last test with a 9000x3000 PNG file (44MB) did use more than 20GB of RAM, which seems extreme for such a file…
So I wonder if that's something expected (and if yes, what would be possible to reduce the memory usage ?) or a bug on my side.
Thanks in advance
Try :
Have a dict:
{
"texturePath0": <FileLike>,
"texturePath1": <FileLike>,
}
As a user I want to be able to keep Exif/XMP/IPTC or other metadata when optimizing an image, so that metadata affecting image rendering are kept.
As we've discussed on discord I've found that when optimizing a file, yoga strip it from metadata. It result in a change of color of resulting image, weither when optimizing to webp or jpg.
Below are source file in JPG, and webp image in a zip (github is not compatible with webp upload)
img_webp.zip
Raw image from a photoshop export, lot of EXIF metadata
Converted image using Gimp, there is still metadata as seen with this extract:
+-- img_export_gimp_no_exif.webp
+-- RIFF [size: 16697518, formtype: WEBP]
+-- VP8X [offset: 20, size: 10]
+-- has_icc: 1
+-- has_alpha: 0
+-- has_exif: 1
+-- has_xmp: 0
+-- has_anim: 0
+-- canvas_width: 4252
+-- canvas_height: 2835
+-- ICCP [offset: 38, size: 532]
+-- VP8L [offset: 578, size: 16696926]
+-- EXIF [offset: 16697512, size: 14]
Optimised image without resizing, with a loss of color, no metadata.
Optimised image with resizing, same loss of color, no metadata.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.