The exact method would depend on the language, but you generally want a few things: a pointer to the image data, a width and height, and color information, primarily format (RGB, RGBA, BGR, grayscale etc.) and channel depth (a 32-bit RGBA image has 4 color channels, and therefore has an 8-bit channel depth. A 24-bit RGB image has only 3 channels but the same channel depth). Once you have this, accessing the nth (where n=0 is the first) channel of a specific pixel would go something like this:
Code:
pixels[(y*width+x)*bytesPerPixel + n]
where bytesPerPixel would be 4 for a 32-bit image, 3 for a 24-bit image, etc., x and y are in pixel units, width is the number of pixels per scanline, and pixels is a byte*, byte[], uint8_t*, uint8_t[], or whatever byte array or byte pointer type is provided by your language of choice.