View Full Version : jpeg images - urgent

06-12-2003, 08:43 AM
I need to read jpeg images as 3D arrays .. could anyone tell my what is the best possible way to do it. i already have code in C for processing the 3D array.. i have been using .img format uptil now which is the simplest way to store images.

Thanks for ur advice.

06-12-2003, 09:41 AM
What do you mean by 'as 3D array'? Multiple 2D images that form volumetric data? Using a single image as a heightmap?

Anyway, as for reading jpeg :

1/the reference library is libjpeg, found at http://www.ijg.org .It's object-oriented C code (function pointers everywhere). Fast and portable. Maybe messy if you are not used to this kind of code.

2/many image libraries provide higher level functions to load jpeg. One example is DevIL, which can be found at http://www.imagelib.org . It uses libjpeg internally, but exposes simple means to load jpeg files. It has OpenGL-style syntax, and also a C++ wrapper.

06-12-2003, 12:35 PM
Also try glBMP (http://www.cfxweb.net/~delphigl/projects/glbmp.htm) , which facilitate reading/writing jpeg, BMP, PNG, GIF as glTextures (with transparency where applicable), and does screen shots.