Jump to content
  • Advertisement
Sign in to follow this  
CastorX

Loading JPEG

This topic is 4849 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hy! I am using VC++ 6.0, how can I load .JPG files? Just loading is required for me, the data must be in the memory in RGB (decoded) format, what is the easyest way? Is there a built-in library in the Visual C 6.0, with I can do that? Please send source code, or good links for me. I'm beginner, the simplest way would be the best. Please help me!

Share this post


Link to post
Share on other sites
Advertisement
Try looking at this site: http://nehe.gamedev.net/ Here he has some code I believe is called IPicture. It is pretty simple to use.

Share this post


Link to post
Share on other sites
There are plenty of image handling libraries out there which are capable of handling JPEG compressed images, a popular one is DevIL which works well with OpenGL. If you want to get down and dirty with the internals of the format you can use the Jpeglib for decoding the files which is available here.

Share this post


Link to post
Share on other sites
Spudder's second recommendation (the IJG's library) is the easiest way to get pixel data in memory. However, if you're able to work with a bit of COM (no extra libraries needed), my favorite way is using OLELoadPicture and the IPicture interface. For example code, see this article on MSDN. (Note that you don't really have to be building an "MFC application" to use this -- my SimpleView program is straight Win32 except for this tiny portion.)

Cheers,
Twilight Dragon

Share this post


Link to post
Share on other sites
There are also other easy options for loading jpeg files depending upon the context of your program. If you are using Direct3D, you can use its image loading utility in D3DX, D3DXLoadSurfaceFromFile. If you are only targeting WinXP and Win2003 or later, you can use GDI+ and use its Bitmap::FromFile function. (GDI+ can also be used on older versions of Windows, but only if you include the library in your distribution.)

Share this post


Link to post
Share on other sites
heh, i just wrote a JPG loader using the jpeglib

simple stuff really

just use their built in functions and its about 6 or so calls to them, and your done, one for loop to build the data, couldnt be simpler, or faster

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!