Saving alpha-0 pixels via ImageIO

Here’s an odd one - saving a png via ImageIO seems to have a ‘cute’ optimisation where all alpha=0 pixels have their rgb values set to 0 as well. Presumably to try and make non-visible pixels compress better.

However I’m just using pngs as a handy way of storting 4 channels of pixel data, so this optimisation throws away some of my data. :frowning: Has anyone else bumped into this issue before as well? How did you fix it?

* Orangy Tang goes looking for alternate png encoders…

Nice optimisation but incredibly useless unless you’ve got premultiplied alpha! If you’re just using pngs to store 4-channel data I’d suggest instead using raw data and gzipping the data yourself, because that’s pretty much all pngs do. In other words custom file format ftw.

Cas :slight_smile: