How does MP (megapixels) Resolution Relate to MB (megabyte) File Size?


At Saturday’s Digital Photography SIG meeting, we got to discussing this subject and I thought I’d post it up so the essence is captured for all the newbies to benefit from since it’s so important and basic.

On my 5 MP Sony camera:

o I can take (color) photos that capture (e.g.)  2592 pixels wide and 1944 pixels high.

o So, 2592 x 1944 = 5.04 MP camera.

o Now, each (color) pixel contains 24 bits of information (R = 8 bits, G = 8 bits, B = 8 bits). This would be one of 16.8 MM unique colors! (Forget the 24 bits if it’s a black and white photo.)

o So, the camera has to deal with 2592 x 1944 x 24 = 120.9 Mbits of information in each photo.

o Or, 120.9/8 = 15.1 MBytes of information.

o With a Fine Quality-JPEG setting, my camera records a photo file size of about 1.9 MB. (The photo usually looks great at this setting. However, I don’t know which one of the 12 JPEG levels the Fine Quality setting equates to. Maybe, #12?)

o Hence, the file compression is (15.1 – 1.9)/15.1 x 100 = 87.4 % (!)

o Where did these 87.4% of (missing) pixels go when the file was recorded? Into a math formula that has a way of (sort of) remembering all this when the photo file is opened up later because (most) all this information is used all over again when we look at the photo. (Remember that the poorer the quality setting, the more the compression and the more the data is lost on the round trip on the closing-opening step. This is why the JPEG format is called a “lossy” format.)

o Some situations where you can use this information are: how many photos can your hard drive (or, memory stick) hold and what’s the trade-off between resolution-quality-file size.  

Here’s a hot link to the web if you want to explore this further:

Maybe some of our more experienced folks can clean this up as we start to comment on it. I thought this subject was important enough that it should be posted for all to see and learn from. 


14 Responses to “How does MP (megapixels) Resolution Relate to MB (megabyte) File Size?”

  1. MaggieM Says:

    I have 8 digital cameras. Ranging from 5 MP to 8 MP. My digital SLR takes a variety of sizes and qualities, depending on your needs from the lowest quality JPG to the combination RAW and JPG file. My lower end point and shoots offer maybe 4 to 5 quality jpgs in various qualities and sizes. DO NOT GET YOUR QUALITY SETTTINGS MIXED UP WITH YOUR SIZE SETTINGS. Most experts advise cutting back on size but not quality if you must save space. This still usually affords a good 5 x 7 to letter size print. All the numbers will vary slightly depending on the cameras output.
    Most important thing to remember. READ YOUR MANUAL. These sizes and quality settings are listed in the manual. Also the various camera manufacturers websites also offer this information.
    Have fun shooting.

  2. QueenE Says:

    With JPG compression, it is not the actual pixels that are lost, but the bits of data within the pixel so that your compressed pixel takes up much less space. The number of pixels remains the same unless you also reduce the resolution (image size) on your camera. Your camera might have 12 different combinations of compression and resolution.

    The type of data that is lost to compression is the mostly the variation in colors. You will also notice that the same camera and jpg setting will produce file sizes that differ by as much as a MB or two. That is because “Large featureless areas (skies, walls, etc.) compress much better (smaller) than images containing much tiny detail all over (a tree full of leaves).”

    A question: My EXIF data shows “Compressed Bits Per Pixel” as 5. I can’t quite figure what this means. Does that mean that I have five bits of data left per pixel after the compression? That would about match the percent of compression as determined by comparing file size (20%).

  3. Carl Farley Says:

    by Carl Farley for QueenE (Liz Lunden) . . .

    Thanks for doing the math on calculating file size! I had no idea you lose so much data even in the most minimum jpg. I ran the numbers on mine and am loosing about 80% of the data.

    I think it would be interesting to take TIF and JPG photos of the same scenes and compare them so we can really see if we miss anything. I would but my camera only takes JPG. Must be time for a new camera! 🙂

  4. Carl Farley Says:

    I was also amazed, some time ago, that the file size of photos could be so small when the number of pixels and color information are taken into account. And, on top of this, even though the .jpg algorithm compresses (and, sometimes destroys) data, (almost) all the data from the photo is still available later for viewing, printing, etc. after the photo is captured.

    Long live the mathematicians!

    P.S. – Maybe someone reading this blog will be inspired to explore your curiosity about the file size of .tif vs. .jpg for the same scene. My camera doesn’t capture in .tif format either.

  5. QueenE Says:

    Carl said—-
    “And, on top of this, even though the .jpg algorithm compresses (and, sometimes destroys) data, (almost) all the data from the photo is still available later for viewing, printing, etc. after the photo is captured.”

    I’m not sure I understand what you mean when you say the data is available later for viewing, etc. My impression is that once you compress pixel data into jpg, it is not recoverable. If somebody knows how to get all that data back, please let me know!!

  6. Carl Farley Says:

    I think your explanation is technically correct. But, my explanation may be more general or practical or understandable for the casual user.

    Put in another way, when a photo is saved with the highest quality .jpg setting, the file size is smaller than with .tif. However, when it’s printed at high quality at a given size, a beautiful photo results. Apparently, the pixels that were lost during compression (and, there are a lot even at the highest quality setting) were not very important to the quality of the printed output. So, if any data are not available for printing, it’s not important anyway.

    Or, put in still another way (how many ways are there?), when the .jpg format was developed, folks most certainly raked over what we’re talking about a whole bunch. The (practical) result is probably how I described it, even though what really happens is closer to how you described it.

    On the other hand, professional photographers never use .jpg (according the mag’s I read), so maybe these lost pixels really are important.

    Margarita, anyone? I’m dizzy!

    P.S. –

    So, here’s another experiment:

    o Take a photo of the same scene using .tif and .jpg settings (highest quality).

    o Print out both at an equal dpi setting at increasingly larger sizes and compare the two while you go along.

    o When does the .jpg fall apart and by how much?

  7. Margaret Says:

    I believe I once, somewhere posted a website where it mentioned that “all” photographers do NOT use TIFF and RAW. Many do use JPG. I will try to find that info again and post it again. Various magazines have run pros and cons. The jpg does not fall apart (visible to the naked eye) until it’s been saved about 10 times (the number they mentioned. It loses a little with each save, but you don’t notice it with your naked eye until about the 10th save.
    I don’t know about the rest of you, but I’ve never changed the same picture file that much and saved it that much. I always go back to a copy of my original when working on a file. When I edit that file, it causes ONE save as. I can than copy, move, duplicate that file as many times as I wish WITHOUT any degradation.
    If I take that file and use it in a slide show, it’s reduced. But I do not need that reduced file for anything else. When I use a saved photo to e-mail, I reduce for e-mailing and send. I DO NOT save that file. So as you see I save as only once. If I wish to edit further on that file, I go back to the original and get another copy and work on it. I DO NOT SAVE AS, over and over.
    I believe in our mini courses on editing, one of the things we stress is to save our work in the file format that is native to the software. Until that file is finished. That way we can save WITHOUT loss of information, until we finish our editing process. Then “save as”. Then for further uses use a copy of that file.
    Hope this helps?

  8. Margaret Says:

    Addition: When I do SPFX and/or scrapbooking with an edited JPG, and save that file. That would be a SECOND save as. However, if I need to redo that, I go back and get a copy of the original file. So at the most.. you will view my jpg file as a second generation.

  9. Actual Camera Experience - Android Forums Says:

    […] with it the last week. Wow, maybe that is right (and not a ~1:1 conversion like I thought): How does MP (megapixels) Resolution Relate to MB (megabyte) File Size? Digital Photography SIG It would be cool if the GN's camera could save RAW format […]

  10. Best lawn mower inthe market great prices top performance and great durability Says:

    Best lawn mower inthe market great prices top performance and great durability…

    […]How does MP (megapixels) Resolution Relate to MB (megabyte) File Size? « Digital Photography SIG[…]…

  11. Electronic Gadgets Says:

    Electronic Gadgets…

    […]How does MP (megapixels) Resolution Relate to MB (megabyte) File Size? « Digital Photography SIG[…]…

  12. Says:…

    […]How does MP (megapixels) Resolution Relate to MB (megabyte) File Size? « Digital Photography SIG[…]…

  13. Johng556 Says:

    Hello my family member! I want to say that this article is amazing, great written and come with almost all significant infos. Id like to peer extra posts like this . kaedecfkdcka

  14. photography classes Says:

    Nice post. I used to be checking continuously this weblog and I’m inspired!
    Very useful info specially the remaining section :
    ) I take care of such information a lot. I used to be looking for this particular information for a long
    time. Thanks and good luck.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: