fnordware / SuperPNG

SuperPNG plug-in for Photoshop
BSD 2-Clause "Simplified" License
174 stars 27 forks source link

Please add premultiply alpha option #11

Open oomek opened 6 years ago

oomek commented 6 years ago

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?

kornelski commented 6 years ago

PNG doesn't support premultiplied alpha.

oomek commented 6 years ago

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.

kornelski commented 6 years ago

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.

oomek commented 6 years ago

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.

oomek commented 6 years ago

The blend mode I use for premultiplied png is a commonly used glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA)

ghost commented 5 years ago

https://github.com/oomek/SuperPNG/releases