The Pi Camera v2 has 3280 x 2464 pixels, which gives 8081920 pixels. It is my understanding that a PNG-24 means the pixel supports a 2^24 color depth. It is also my understanding that a PNG-24 means 24 bits per pixel (bpp). This would mean that for a single PNG-24 image, there are 8081920 pixels x 24 bits/pixel = 193966080 bits or about 24.24576 Megabytes. However when I capture an image using -e png
encoding, I get an image of about 2.162 Megabytes, which is about 10x smaller than predicted. What am I doing wrong? Can someone help clarify how to predetermine the file size.
-
The wikipedia entry explains how png files use lossless data filtering and compression to reduce size.– meuhCommented Sep 10, 2017 at 14:41
Add a comment
|
1 Answer
Your calculation would fit to an uncompressed image file format (e.g. BMP), but PNG is compressed - although it uses lossless compression, so gives the same result as a large uncompressed format would give.
Predicting the size of a resulting PNG file could only be done by knowing something about the image content at the time of the prediction, approximating by the mathematical methods of PNG compression.