PDA

View Full Version : how to read a jpg image?



Hoffman
05-06-2002, 01:33 AM
I suppose it must be easy for you, but I didnt find anything...
Could you give me a link or a program that reads and draws a jpg image?
I work with Visual C++.
Thank you very much. http://www.opengl.org/discussion_boards/ubb/smile.gif

mikael_aronsson
05-06-2002, 01:36 AM
Hi !

Reading a jpeg image is pretty messy so you should go for a library that can handle it for you, I don't know of any one that works with C++, but I am pretty sure you can find one, at least if you are ok with a GPL or LGPL license. Give google a try.

Mikael

05-06-2002, 01:41 AM
IMHO, the best way to load textures is to use an underlying library like SDL to interface with OpenGL, then use a seperate library (like SDL_image) to load all your textures.

coredump
05-06-2002, 03:37 AM
yes jpegs are hard to read, as they are compressed. if you feel you can handle it, go to wotsit (http://www.wotsit.org) to read the jpeg format.

b

DFrey
05-06-2002, 04:32 AM
http://www.ijg.org/

Note: though the main page of that site does not say so, the library they have also supports decompression. And the use of this library is not bound by any restrictive license. Your only requirement is to say you are using it.

rpxmaster
05-06-2002, 07:43 AM
DevIL's the one that I use. http://sourceforge.net/projects/openil/ It can load just about any image file format you'd ever want, and the API is as simple as hell.

I think when they compiled it, they used the libs from http://www.ijg.org/ to do Jpegs, though.

05-06-2002, 12:37 PM
www.robals.com/easyjpeg (http://www.robals.com/easyjpeg)

Omaha
05-06-2002, 01:26 PM
devIL is good, if they could decide on a name once and for all.

Personally, I'm still an old stand by of the best way to do anything is to do it yourself, but JPGs are such a hassle, it's just so much easier in this case to use pre-written code.

The important thing is understanding how the file works.

nickels
05-06-2002, 01:29 PM
1) Use photoshop to convert it to a .bmp
2) Load it using less complicated .bmp software.

(This is what I do. You may not be able to)

jpummill
05-06-2002, 05:26 PM
You can try
http://www.gametutorials.com/Tutorials/OpenGL/OpenGL_Pg1.htm

I saw this on the current news page at this site today.

enjoy,
jpummill