yoga
yoga copied to clipboard
Grayscale encoding mode
This is a bit of a corner case, but it is useful for massively shrinking size further when dealing with scanned documents, especially text or some types of drawings: the ability to force the image to be in grayscale instead of RGB color. Oftentimes, document scanning apps (or people who do the scanning) may not think (or know) to encode that way, so the image is imperceptibly color even though perceptually it is grayscale. Converting to grayscale, for PNG and other lossless (or lossy) formats helps a ton... but doing it one image at a time with GIMP is a pain in the butt.
The same rule applies to alpha channels: sometimes there is one even if you don't necessarily need it, and it's extra weight that could be discarded (if the user knows what they're doing :)
For the Alpha channel, it should already be removed if it not used. If you ever find a picture with an unused alpha channel that is kept after encoding, please open a bug with the image and the selected options so I can check and fix it :)
Oh wow that's amazing. I didn't know it was easy/possible to autodetect the relevance of alpha channels!
It is easy to know if it is not used at all. For that, you have to look at each pixels: if the value of the alpha channel is 255 it means the pixel is opaque; and if all pixels are opaque, there is no need of an alpha channel :)