#Change Image compression via tool script.

1 messages · Page 1 of 1 (latest)

shell sluice
#

Is there a way I can decompress a texture to Lossless quality and then change it back to VRam Compressed via a tool script?

When I use image.decompress() it doesnt seem to actually make it lossless.

I need this to read some pixel data in the image but when its compressed the data is lost. when its lossless its there. So I need to swap it and change it back via my script.

stiff heart
#

This is why images being re-shared online tend to irreversibly loose quality over time.

shell sluice
#

Yea makes sense ig.
I made a tool for my artists with godot to create spritesheets. since the game is HD and has lot of frames we condense frames that are identical and add a delay for them.

So i made a tool to write the delay data / row counts / frame counts into some pixels of the image.
When the image is imported as lossless I can read it just fine.
But if its vramcompressed i cant use get_pixel

I thought about trying to add metadata to the image instead but cant find how to do that. since the tool saves the final image as a png that we then import to the game. where I have a tool script to read that data and make the animation with it.

But I want to use VRAM Compressed in the end of it because one spritesheet can go from 70mb vram to 17mb with it and looks no different.

stiff heart
#

You can create custom importer scripts. Which should also be able to extend from existing importers. That would let you intercept the image and save metadata to the Resource during import.
But you'd have to check the docs, i really haven't tried in a long time.