Description
Describe the project you are working on
Visualizing medical data images
Describe the problem or limitation you are having in your project
At the moment, if you want to store image data, you have limited means to do so. You can store raw data, but it is verbose. You can save to EXR, but there is no coresponding load_exr_from_buffer()
method to turn your saved data back into raw data. PNG would seem to be way around this, since modren PNG will allow you to store floating point data. However, the default Godot implementation will convert your images to RGBA8 before saving them regardless of the format the data is originally in. Since I am using mostly RF and RGBAF data, saving my buffer to a PNG is effectively destroying my data.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Add a flag to the Image.save_png_to_buffer()
to hint that the data format of the image should be preserved. Or let the user pass in the data format that they want to use. Then when the PNG is saved, it will choose the PNG container which can handle that data.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Add an extra parameter to the save_png_to_buffer
method to indicate that the data format should be preserved.
Image.save_png_to_buffer(preserve+format:bool = true)
If this enhancement will not be used often, can it be worked around with a few lines of script?
No
Is there a reason why this should be core and not an add-on in the asset library?
Involves changing PNG writing.