Dictionary

What Are Megapixels?

Cameras and phones are often compared by megapixels, and an image's metadata can show its own pixel count in the same unit. Find out what the number means and how it is calculated.

megapixels

Megapixels tell you how many pixels an image has, counted in millions. One megapixel is 1 million pixels, because the prefix mega means 1 million. A digital image is a grid of tiny points called pixels, set out in rows and columns.

You often see this number when you compare cameras and phones. When you read the metadata of a file, the Megapixels field gives the pixel count of that one image. The value is the width in pixels times the height in pixels, divided by 1,000,000.

Where the value comes from

Your file does not store a Megapixels value. The program that reads the metadata calculates it from 2 other fields, the image width and the image height. ExifTool calls Megapixels a composite tag, which is a value calculated after all other information is read.

The program first builds the Image Size field, for example 1920x1080. Then it multiplies the 2 numbers and divides the result by 1,000,000.

Because the value is calculated, you cannot edit the Megapixels field directly. The value changes only when the image gets a new width or height.

Which files carry it

Any file that records a pixel width and height can show Megapixels. The value is not limited to photos:

  • JPEG photos store the width and height in a marker called start of frame.
  • PNG images store the width and height in the image header block.
  • TIFF images store the width and height in the tags ImageWidth and ImageLength.
  • For Canon CR2 RAW files, ExifTool uses the size the camera wrote into the Exif block.
  • MP4 and MOV videos store a width and height in the header of the video track. Here the value describes one frame of the video.

What the values look like

The value is a decimal number in millions of pixels. ExifTool rounds it to 1 decimal place when the value is 1 or more. Smaller values get 3 decimal places, and values below 0.001 get 6.

These examples use image sizes from published standards:

  • 640x480, the sample image in the Exif specification, gives 0.307
  • 1920x1080, the HDTV picture in ITU-R BT.709, gives 2.1
  • 3840x2160, the smaller UHDTV picture in ITU-R BT.2020, gives 8.3
  • 7680x4320, the larger UHDTV picture in ITU-R BT.2020, gives 33.2

Rounding hides the exact count. An image of 1920 by 1080 pixels has 2,073,600 pixels, and the field shows 2.1.

Why it matters for your file

The pixel width, divided by the X Resolution value, gives the printed width of an image. X Resolution says how many pixels go into each inch or centimetre. An image 3840 pixels wide, printed at 300 pixels per inch, comes out 12.8 inches wide, which is about 32.5 centimetres.

Megapixels cannot tell you how sharp a photo is, how much noise it has, or how good the lens was. A photo with more megapixels is not automatically a better photo.

Some edits change the pixel count. Cropping removes pixels, so the value drops.

When software enlarges an image, it adds new pixels to fill the larger grid. The Megapixels value goes up, but the new pixels are estimated from the old ones. They add no detail that the camera recorded.

Megapixels are also not the same as file size. The uncompressed RGB sample image in the Exif specification, 640 by 480 pixels, holds 921,600 bytes of image data.

JPEG compression with typical settings makes a file 10 to 20 times smaller. This means 2 files with the same megapixels can have very different file sizes.