How Pixels Are Converted to Bytes

Techwalla may earn compensation through affiliate links in this story.
How Pixels Are Converted to Bytes

File Information

When a person talks about converting "pixels" to "bytes," he is not talking about a literal conversion. What he is referring to is a mathematical calculation that determines how large an image file will be based on its resolution. It sounds complicated, but in reality it is no more involved than plugging a few easily obtainable numbers into a mathematical equation.

One of the two pieces of information that are required for the calculation are the width and height of an image. This is called the resolution. The unit of measurement will be in "pixels", which is another term for "picture elements."

The second piece of information needed is the number of colors per pixel in the image. This is called the image "depth."

General Data

As a rule, there are 16 bits of file size per pixel. This means that there are 8 bits per byte of file size, as 2 bits equals 1 byte. In keeping with things that are equal, this then means that there are 2 bytes of file information per pixel contained in the image.

It is easy to calculate the amount of pixels contained within an image. You can look this up in the image information of the particular file you're working with, or you can do the calculation yourself. For example, if your display has a resolution of 800x600, then 800 multiplied by 600 is 480,000 pixels.


You can now do the calculation and discover how many bytes are in your image. The number of bytes is equal to the number of pixels multiplied by the number of bytes per pixel. As we've already found how many pixels are in the image (480,000), and that there are 2 bytes of information in a pixel, the equation then becomes:

480,000 pixels multiplied by 2 bytes per pixel.

This gives us a final answer of 960,000 bytes. Remember that this equation can be performed for a file of any size, no matter the amount of pixels contained within. Just substitute the appropriate numbers and calculate away.