PDA

View Full Version : image rgb values into an array



bramley1
06-13-2002, 03:33 AM
Hi,
Anyone got any ideas how to read the rgb values of an image into an array.
Ive done plenty of file input and ouput programs before, but I dont know how to access the rgb values of each pixel.
Thanks

Duncan

mikael_aronsson
06-13-2002, 03:43 AM
Hi !

Are you talking about reading from the framebuffer ?, in that case you use glReadPixels(), if you are talking about image files like bmp, png or what ever, then OpenGL does not support this, but there are lots of libraries out there that can help you (google)

Mikael

bramley1
06-13-2002, 05:26 AM
Thanks for reply
im looking to read from an image NOT the framebuffer

Deiussum
06-13-2002, 05:32 AM
It depends entirely on the image format. www.wotsit.org (http://www.wotsit.org) has the file spec for many, many different file formats. Generally, in an uncompressed image format, somewhere in there is an array of RGB values.

There are also libraries like SDL_image that you can use for reading in various image formats.