Loading .jpg images from a file

This is a discussion on Loading .jpg images from a file within the Windows Programming forums, part of the Platform Specific Boards category; It doesn't appear as if Windows API has native support for loading .jpg or gif images. So what is the ...

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    39

    Loading .jpg images from a file

    It doesn't appear as if Windows API has native support for loading .jpg or gif images. So what is the best way to load .jpg or gif images -- from a file, not a resource -- using API?

    Could someone point me in the right direction?

    thank you

    Echidna

  2. #2
    Registered User
    Join Date
    Feb 2002
    Posts
    591
    I would try to see if there is an ActiveX to display a jpg

  3. #3
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    OleLoadPicture can handle most image formats including jpeg & gif.

    Gdiplus also has support for handling all sorts of image formats which comes as part of winxp. You can download the dll etc from ms if you don't have/use xp - do a search on this forum as i've posted a link to it a few times.

  4. #4
    Registered User
    Join Date
    Sep 2001
    Posts
    39
    Thanks for the help.

    I found an example here:
    http://support.microsoft.com/default.aspx?scid=kb;en-us;Q218972

    http://support.microsoft.com/default...US/Loadpic.exe

    The problem with it is that it doesn't realize the palette on systems that only display 265 colors -- I just happened to compile the code on my old laptop.

    The image displayed using the LoadPic.exe only shows 16 colors. Is there a way to get the OleLoadPicture() function to realize the palette???

    Has anyone else encountered this problem?

    (I will look into the "Active X" suggestion)

  5. #5
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Didn't know about that LoadPic example - it's a good one. Thanks.

    I found the gdiplus links:

    Go here to get GDI+ run-time dll - (it's called 'GDI+RTM'):

    http://www.microsoft.com/msdownload/...psdkredist.htm

    I didn't notice any problem with displaying images with more than 16 colours - nor was I aware of the 256 colour display problem either. Both interesting - but unfortunately I don't have a clue at the moment. I will take a look at it....sometime.

    Good luck anyway.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. File Writing Problem
    By polskash in forum C Programming
    Replies: 3
    Last Post: 02-13-2009, 09:47 AM
  2. Data Structure Eror
    By prominababy in forum C Programming
    Replies: 3
    Last Post: 01-06-2009, 08:35 AM
  3. gcc link external library
    By spank in forum C Programming
    Replies: 6
    Last Post: 08-08-2007, 03:44 PM
  4. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 01:53 AM
  5. archive format
    By Nor in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 08-05-2003, 07:01 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21