-6

How to calculate the image file size given:

Image width (in pixel): 70/ 300/ 640 &

Width to height aspect ratio. Ex: 1.5

Ram
  • 331
  • 1
  • 3
  • 11

1 Answers1

2

In order to calculate image size you need to say which format. Some formats have headers which are a few bytes and some are a few kb. there are also headerless images some of the (*.Raw). Next you need to know how many bits or bytes per pixel. Each color can be represented in different bits accurate.
Then you do header + (width *height *bytes per pixel) . This is what you basically want to do.

Gilad
  • 6,437
  • 14
  • 61
  • 119
  • Image is in Jpg format. – Ram May 08 '14 at 20:33
  • 3
    @Ram, it is absolutely impossible to calculate this for a JPG, since JPEG is a lossy compression format. The file size will depend on the image composition and the amount of compression (JPEG quality). – Sparky May 08 '14 at 20:36