Image Pixel Data

An image file is an array of numbers. For a black and white image, it’s a 2 dimensional array with lightness values. For each (x,y) coordinate in the image, there is a single number representing the lightness of the pixel.

Here’s a simple example of what data might look like for a 3×3 pixel image:

Lightness x = 0 x = 1 x = 2
y = 0 0 85 170
y = 1 170 255 85
y = 2 85 170 0

A zoomed in version of this tiny image looks like this:

The black pixels have a lightness of zero, and the white pixel in the middle has a lightness of 255. The values in between represent light or dark shades of gray.

A color image has more data. Instead of storing a single number for each pixel on the grid, it stores three numbers representing RGB values (red, green, blue).

(R, G, B) x = 0 x = 1 x = 2
y = 0 (255, 0, 0) (0, 255, 0) (0, 0, 255)
y = 1 (255, 255, 0) (255, 255, 255) (255, 0, 255)
y = 2 (0, 0, 0) (128, 128, 128) (0, 255, 255)

Color images are 3 dimensional arrays.
The three dimensions are x, y, and color. For each (x,y) pixel value, there is a one dimensional color array containing three values.

You can use a Color Picker to get the RGB values for a certain color, or to figure out what color a certain combination of RGB values would create.

W3 Schools Color Picker

Google Color Picker