-
Is there a way to roughly estimate the filesize before thumbnailing an image? I did some tests and hoped that the file size would be roughly proportional to the sum of pixels (area) in the thumbnailed image, but this is not the case. It seems as if smaller images proportionally require more disc space than larger images. To show this effect, I used a JPEG photo sized 1920x1080 with a filesize of 245592 bytes. From this photo I created multiple thumbnails keeping the same aspect ratio. These are my results:
For estimating the file size I use this formula:
Is there a kind of correction factor to get better estimates? Presumably one has to take the image's entropy into account, since that may vary widly. Maybe I have to use PIL's |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I'm not very optimistic. What level of accuracy are you hoping for in these estimates?
|
Beta Was this translation helpful? Give feedback.
If you're willing to create a larger thumbnail in the process of generating this estimate, then why not actually create a thumbnail at the intended size and see what filesize it is? It would be quicker.