As you probably know, PNG-32 contains an RGB area and an Alpha Channel. The Alpha Channel is made for transparency or translucidity. This channel is superposed to RGB channels. Each pixels in Alpha Channel is a value between 0 and 255. 0 means totally transparent, and 255 mean totally visible.
| PNG : RGB area and Alpha Channel | ||
| PNG | RGB Area | Alpha Channel |
![]() |
![]() |
![]() |
| 45,7 KB (46 876 Bytes) | ||
As you can see, the Alpha Channel contains values which are 0 (black pixels) or others values which varies between 1 and 255 (represented in white, gray, etc.). This represents the degree of transparency / translucidty. As you can see, when value is 0 in Alpha Channel, colors contained in RGB area are not displayed.
You can see unuseful pixels distincly by converting the background to a high contrast color. To do that, you can use ImageMagick, with following command :
convert "image.png" -background Red -alpha Background "image-filtered.png"
| PNG | RGB Area | Alpha Channel |
![]() |
![]() |
![]() |
In this example, all unneccessary pixels are converted with 255,0,0 (Red) values. And sure, you can choose the color by replacing Red with Green, or another value.
| PNG | RGB Area | Filter | Output Size |
![]() |
![]() |
None | 42 490 Bytes |
If pixels in RGB area are not displayed when corresponding pixel in Alpha Channel is 0, the first idea is to convert it to 0,0,0 (pure Black color). This is a very simple (but efficient) technic, which is used by some tools (or online service) as PNGOptimizer, PunyPNG, TruePNG (0.3.2.9 or inferior), PNGKT, CryoPNG with -f0 option, etc. |
|||
![]() |
![]() |
Sub | 41 598 Bytes |
If RGB data can be converter to 0,0,0, they can also contains any RGB values. The idea here is to use the delta filtering Sub directly in the user RGB area. It can gives a smaller file than Nonefilter. Used by TruePNG (0.3.5.2 or superior), CryoPNG with -f1 option. |
|||
![]() |
![]() |
Sub (inverted) | 42 031 Bytes |
| This method is not used by any tools (not yet). It's a homemade modification, inspired from Sub filtering. It's an inverted Sub filtering. | |||
![]() |
![]() |
Sub (extended) | 41 341 Bytes |
This method is not used by any tools (not yet). It's a homemade modification, inspired from Sub filtering. It extends all pixels instead of some. The goal here is to convert all 0,0,0 values with the value of nearest pixel in the left / right. |
|||
![]() |
![]() |
Up | 41 829 Bytes |
This method allow to convert the pixel in a new RGB value, generated from the above pixel. It can give some interesting results on some samples. Used by TruePNG (0.3.5.2 or superior), CryoPNG with -f2 option. |
|||
![]() |
![]() |
Up (extended) | 41 318 Bytes |
This method is not used by any tools (not yet). It's a homemade modification, inspired from Up filtering. It extends all pixels instead of some. The goal here is to convert all 0,0,0 values with the value of nearest pixel from up / bottom. |
|||
![]() |
![]() |
Average | 44 213 Bytes |
The average filter does the difference between each pixel line with the average of the left one and above one. Most of the time, this filter give the worst result. Used by TruePNG (0.3.5.2 or superior), CryoPNG with -f3 option. |
|||
![]() |
![]() |
Paeth | 41 232 Bytes |
| Paeth filtering is the most complex. It does the difference between each pixel on the line with the results of the Paeth predictor. This method give a lot of good results. Used by CryoPNG with -f4 option. | |||
![]() |
![]() |
Paeth (inverted) | 41 785 Bytes |
| This method is not used by any tools (not yet). It's a homemade modification, inspired from Paeth filtering. | |||
![]() |
![]() |
Paeth (extend 1) | 40 979 Bytes |
| This method is not used by any tools (not yet). It's a homemade modification, inspired from Paeth filtering. It converts all 0,0,0 values from left / right values. | |||
![]() |
![]() |
Paeth (extend 2) | 40 975 Bytes |
| This method is not used by any tools (not yet). It's a homemade modification, inspired from Paeth filtering. It converts all 0,0,0 values from up / bottom values. | |||