Open oomek opened 6 years ago
PNG doesn't support premultiplied alpha.
What do you mean by saying png does not support it? It’s just a colour information and how you use it and with what blending mode it’s up to you. I use png’s with premultiplied alpha to avoid fringing while scrolling with sub-pixel accuracy, but currently I have to use a macro that saves the temporary image with dds uncompressed with premultiplication ticked, open it and then save again with SuperPng. It would be nice to have it in this plugin.
I mean the PNG spec says the RGB values are not premultiplied, and every decoder must display them as such. Putting premultiplied values in the file would make semitransparent colors look too dark.
I'm guessing you want premultiplied RGBA stuffed into the file anyway, ignoring the PNG spec, as you're planning to interpret color data your way ignoring what they are supposed to mean.
That’s exactly what I do. The png’s with premultiplied rgb with alpha are internally used in my app and labeled as premultiplied. Btw in the manual I see I can premultiply with alpha in the loading dialog. So I can modify the macro with dds exporter, still though it’s just a workaround. The theme creators using our frontend would need an explanation of how to construct the macro so they can use their transparent pngs in their themes without artifacts during animations.
The blend mode I use for premultiplied png is a commonly used glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA)
If this project is still alivie would it be possible to add an option in the save dialog box that premultiplies colour with alpha please?