How many megapixels are in a megabyte?

Megapixels and megabytes are not directly related. Pixels are used to describe the resolution of an image, whereas bytes are used to describe a measure of data. mega- is a prefix used to describe how much of them there are (1 million).


If, for instance, a 1 megapixel image is stored with 24-bit color (8 bits for red, 8 bits for green, and 8 bits for blue), the total amount of memory required to store it would be 3 megabytes (24 megabits / 8 bits per byte). On a disk, an image is stored with less space than this, though, due to data compression. A diagram or other line art can be stored with fewer bytes using "lossless compression", like a .zip file or .png file, while a photographic image is usually reduced in size through "lossy compression" which throws away some data that we don't really notice with our eyes.