My experiment (see image collage below):
- I created an white 640x400 image in GIMP and exported as png. It weights 1409 bytes.
- Then I added a black coloured line and exported as png. It weights 1694 bytes.
- Then, I coloured that line red and exported as png. It weights 1754 bytes.
- Starting from the white image in 1., I added a red square and exported as png. It weights 1426 bytes.
- From 4., I duplicated the red square and put it somewhere else in the image. I was expecting the png to weight 1426 + (1426-1409) = 1443. Instead, it weights 1729 bytes.
- Finally, I moved that red square elsewhere, hoping the image to weight 1729 bytes, and instead, it weights 1741 bytes.
I am utterly puzzled. I was expecting pixels to weight the same. This is clearly not the case. Well, maybe colors have different byte structure (e.g. red uses more 1s and 0s than white), but at least a red pixel weights the same everywhere. Steps 4 and 5 confirm that is not the case either. And finally, step 6 indicates that position also matters! Insane!
Can you please shed light on what is going on?