bruvzg / gdsdecomp

Godot reverse engineering tools
MIT License
1.42k stars 138 forks source link

Export textures as JPEG and WEBP #43

Closed nikitalita closed 2 years ago

nikitalita commented 2 years ago

This commit adds support for saving textures as WEBP and JPEG.

If textures are originally imported from WEBP and JPEG files, if we were to export them as PNGs, they won't be reimported without rewriting every reference to the resource in the project. This is can be rather dicey, and meddles with the project files more than I'm comfortable with. The simple alternative is to just re-save them as WEBP and JPEGs.

To accomplish this, I have added an external JPEG Library, toojpeg . This is a zlib-licensed (aka 3-BSD) JPEG encoding library and only contains 670 lines of code, and produces high quality JPEGs with minimal loss.