What's the maximum file size of a jpg image?
I'm attempting to ascertain the maximum file size possible of a jpg to detect when someone has hidden additional data (viruses etc) within it.
Assuming that you have an image that is 640x480 with no metadata (no camera make, gps data etc), what is the maximum size that that file can be? Is there an formula for calculating this with other jpg dimensions?
Assuming that no compression has been applied to the file, there are 307,200 pixels, which is a 0.3MP. Handy look up table
If each pixel contains 24 bits of information for Red green and blue, then
- 307,200 * 24 = 7,372,800 bits of information
- Divide by the 8 bits to become a byte value
- 7,372,800 / 8 = 921,600 bytes (Or 0.9 Mb)
I hope my Saturday night reasoning is intact, but the good mathematicians and computer scientists may well correct me.