Inochi2D / inochi2d

Inochi2D reference implementation aimed at rendering 2D puppets that can be animated in real-time (using eg. facial capture).
BSD 2-Clause "Simplified" License
1.25k stars 47 forks source link

Minor wiki mistake: PNG is a lossless image format #28

Closed Speykious closed 1 year ago

Speykious commented 1 year ago

In the Inochi2D wiki, on the INP Data Interchange format page, it says that PNG is lossy, but it is actually lossless.

image

LunaTheFoxgirl commented 1 year ago

PNGs are slightly lossy when it comes to transparency, hence we label it as lossy. Same transparency artefacts do not appear in TGA.

LunaTheFoxgirl commented 1 year ago

Apparently it might be a bug in our PNG decoder or multiple encoders

Speykious commented 1 year ago

Oh, interesting

KuukoShan commented 1 year ago

I just got this in my inbox and thought it might be interesting to comment on it. PNG is completely lossless. Photoshop native PNG exporter it's limited and it clears the pixels of the alpha channel. But this is a limitation of Photoshop more than PNG itself. If you save files as 16 bits instead, this doesn't happen so much at all. I do recommend, however, looking into SuperPNG exporter for Photoshop as it allows to export PNG files with a completely separated alpha channel (32 bits) instead of transparent pixels (24 bits).

So my whole point is that, yes, PNG are completely lossless files and they support a higher bith depth than TGA.

LunaTheFoxgirl commented 1 year ago

Text has been updated to say Lossless, though we'll need to investigate further whether the semitransparent pixels losing info thing is a exporter or importer problem.

lain-dono commented 1 year ago

Maybe there are some blending problems there?

You can greatly improve the quality of rendering if you do it right. You will most likely want to deal with linear color space and premultiplied alpha.

https://blog.johnnovak.net/2016/09/21/what-every-coder-should-know-about-gamma/ https://www.adriancourreges.com/blog/2017/05/09/beware-of-transparent-pixels/ etc...

PNG is absolutely lossless. The problem may be in how this data is interpreted. And also what data is written there.

LunaTheFoxgirl commented 1 year ago

Fixed in the doc page at https://docs.inochi2d.com/en/latest/i2d/spec/inp.html#texture-encoding