The format is a bytes in lines. The line length is in the image structure. Each line has a fixed number of pixels. The line can be longer than the pixel data. The pixel format (bytes per pixel) depends on the type of image, and the bit depth. Some formats have the RGB values spanning bytes. Look at the description of the different types.