There are many different ways images are stored in image files.
.bmp files use half, one, two, or three bytes per pixel to encode that pixel. The pixels are arranged in rows from left to right, one row at a time, from the top to the bottom. A header on the front tells the file attributes and image dimensions.
.gif and .jpg use compression techniques to shrink the file size, by taking groups of identical pixels and recording the group size and color.
.cdr files (line tracing) use line and curve descriptions for the edges of the regions, and field descriptions for the fill style inside them.