Closed friksa closed 6 years ago
Hi, what exactly do you mean? what space is wasted?
A PNG that has an alpha channel is bigger than a PNG without an alpha channel.
UPNG.js was created to let programmers work with a consistent image input/output format (RGBA, 8 bits per channel), whithout worrying about PNG-specific internal representation.
It seems like you want to go into PNG-specific details. Just because UPNG wants you to give it an alpha channel, it does not mean output files are bigger, than if you gave it RGB only. In fact, UPNG.js checks, if all pixels have alpha=255, and if they do, it stores the file as RGB PNG (colour type 2 instead of 6).
The same is true for indexed image. When alpha is constant 255, "tRNS" chunk is omitted.
It would be nice to create a PNG file that does not use the alpha channel (every pixel has a color and alpha is always 255). Since I know that there is no alpha channel, it seems like a lot of wasted space to encode an alpha channel that is always 255.
Thanks!