← All posts
8 min read

How Images Become Data: Pixels, Color, Resolution, and Files

#technology#computer-science#images#data
📑 On this page

A digital photograph may show a face, mountain, document, or distant galaxy. To a computer, it is structured numerical data.

For most photographs and screenshots, the basic model is:

A raster image is a rectangular grid of pixels, and each pixel stores numbers describing color.

That model is simple enough to understand in a few minutes, yet powerful enough to support modern photography, video, medical scans, satellite imagery, and computer vision.

Pixels are samples, not tiny squares in nature

The physical world does not contain pixels. A camera or scanner divides its view into many measured locations.

Each pixel is one sample in a two-dimensional grid. Software often displays pixels as small colored rectangles, but the stored value really describes a sample location.

An image that is 4,000 pixels wide and 3,000 pixels high contains:

4,000 × 3,000 = 12,000,000 pixels

That is a 12-megapixel image.

More pixels can capture finer spatial detail, but the result also depends on lens quality, focus, lighting, sensor size, processing, and noise. A large pixel count does not rescue a blurred or badly exposed photograph.

Resolution describes pixel dimensions

The word resolution is used in several ways, so context matters.

For a digital image, it often means pixel dimensions:

1920 × 1080 pixels

For printing, people may discuss pixels per inch or dots per inch. The same image pixels can be printed over a small area for a sharp result or stretched over a large area where individual pixels become noticeable.

For screens, physical size and pixel count together determine pixel density. A phone and television might both display a 1920 × 1080 image, but the phone packs those pixels into a much smaller physical area.

Resolution answers how many spatial samples exist, not whether the image is artistically or technically good.

How a pixel stores color

Many images use three color channels:

  • Red
  • Green
  • Blue

This is the RGB model used by light-emitting displays. Different intensities combine to produce many perceived colors.

With eight bits per channel, each channel can store a value from 0 to 255:

RGB(255, 0, 0)     → bright red
RGB(0, 255, 0)     → bright green
RGB(0, 0, 255)     → bright blue
RGB(255, 255, 255) → white
RGB(0, 0, 0)       → black

Three eight-bit channels create 24 bits per pixel and more than 16 million possible RGB combinations.

Some formats add an alpha channel describing transparency. Others store more bits per channel for smoother gradients or wider editing range.

Color depth and precision

Color depth describes how many bits are available for representing color values.

More bits provide more levels:

Bits in one channelPossible levels
12
416
8256
101,024
1665,536

Low precision can create visible bands where a smooth sky should gradually change color. Higher precision gives editing software more room to adjust exposure and color without revealing abrupt steps.

However, greater color depth increases data size and requires compatible capture, processing, storage, and display systems. If the final screen supports only a narrower range, some captured detail must be mapped into that range.

From light to camera data

A simplified camera pipeline works like this:

  1. A lens focuses light onto an image sensor.
  2. The sensor contains many light-sensitive sites.
  3. Each site converts incoming light into an electrical response.
  4. Electronics measure those responses.
  5. An analog-to-digital converter turns measurements into numbers.
  6. Software estimates color, reduces noise, adjusts tone, and creates an image.
  7. The image is encoded in a format such as JPEG, HEIF, or a raw format.

Camera sensors commonly use color filters so neighboring sensor sites measure different portions of the light spectrum. Software then estimates full color values for each output pixel through a process called demosaicing.

The photograph is therefore not a direct untouched copy of reality. It is a carefully processed measurement.

A concrete example: raw pixel size

We can estimate the uncompressed size of an RGB image.

For a 1920 × 1080 image with three bytes per pixel:

1920 × 1080 = 2,073,600 pixels
2,073,600 × 3 bytes = 6,220,800 bytes

That is roughly 6.2 MB before metadata and structural overhead.

A 12-megapixel image would need roughly 36 MB for simple 24-bit RGB pixel data:

12,000,000 × 3 = 36,000,000 bytes

Yet a JPEG from the same camera may be only a few megabytes because compression stores the visual information more efficiently.

Image formats are rulebooks

An image file contains more than a flat list of colors. Its format describes how to interpret the bytes.

JPEG

JPEG is commonly used for photographs. It usually applies lossy compression, reducing file size by discarding and simplifying details in ways designed to be less noticeable.

Repeated editing and saving can introduce visible artifacts because each lossy save may remove more information.

PNG

PNG uses lossless compression and supports transparency. It is often suitable for screenshots, diagrams, logos, and images with sharp edges or repeated flat colors.

Photographs may be much larger as PNG than JPEG.

GIF

GIF supports simple animation but has a limited color palette for each frame. It remains common for short web animations despite newer alternatives.

SVG

SVG is fundamentally different from raster photography. It describes vector shapes, paths, and text. Because shapes are mathematical, they can scale without becoming pixelated. SVG works well for icons and diagrams but not as a direct substitute for every photograph.

Raw formats

Camera raw files preserve sensor measurements with greater processing flexibility. They are larger and require development software, but photographers can make more extensive exposure and color adjustments.

Metadata around the pixels

Image files may contain metadata such as:

  • Camera model
  • Capture date and time
  • Exposure settings
  • Orientation
  • Color profile
  • Copyright information
  • Geographic coordinates

Metadata makes images easier to organize and display correctly, but it can also reveal private information. Sharing a photograph may unintentionally share where and when it was taken.

Many social platforms remove some metadata during upload, but you should not assume every service does.

Scaling and interpolation

When an image is enlarged, software must create output pixels that did not exist in the original.

Interpolation estimates new values from neighboring pixels. Simple methods may produce blocky or blurry results. More advanced algorithms can preserve edges more effectively, and machine-learning systems can generate plausible detail.

Generated detail is not recovered evidence. If an enhancement system invents a sharp-looking license plate from an unreadable source, the result may be visually convincing without being factually accurate.

Shrinking also requires choices. Software combines or removes samples while trying to preserve the important visual structure.

Common misunderstandings

"More megapixels always means a better camera"

Pixel count is only one factor. Sensor quality, lens quality, lighting, processing, dynamic range, and noise can matter more.

"A pixel has a fixed physical size"

An image pixel is a sample in data. Its physical display size depends on the screen, zoom level, print dimensions, and rendering process.

"PNG is always higher quality than JPEG"

PNG is lossless, but suitability depends on the content and purpose. A carefully encoded JPEG can look excellent while being much smaller for photographs.

"AI enlargement reveals the original hidden detail"

It estimates plausible detail based on learned patterns. That can improve appearance, but invented information should not be treated as recovered fact.

Knowledge check

1. How many pixels are in a 2000 × 1500 image?

It contains 3,000,000 pixels, or 3 megapixels.

2. What does RGB(255, 255, 255) normally represent?

With eight-bit RGB channels on a standard display, maximum red, green, and blue combine to produce white.

3. Why can a JPEG be smaller than raw RGB pixel data?

JPEG uses a more efficient compressed representation and usually removes some visual detail that its design considers less noticeable.

4. Does increasing image dimensions recreate missing original evidence?

No. Interpolation or AI can estimate new pixels, but those estimates were not measured by the original camera.

The one idea to remember

A digital raster image is an ordered grid of numerical color measurements.

Resolution determines how many spatial samples exist, color depth determines how many values each sample can express, and the file format determines how those measurements and their metadata are encoded.

Next, we will follow the same pattern through time and learn how a stream of measurements becomes digital sound.