Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Need some help working with JPEGs...

Need some help working with JPEGs...

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++graphicsgame-devhelp
6 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    CoffeeAddict19
    wrote on last edited by
    #1

    Basically what I'm trying to do is add the functionality to let the user select a JPEG background image for my game, as eye candy. MFC has functions for handling bitmaps but nothing for JPEGs or other image formats. I'd like to load a JPEG and convert it to a bitmap so that I can blit it as necessary. What is the best way to do this? I'd rather do it without tacking on a huge library to my program, if possible.

    J H M T 4 Replies Last reply
    0
    • C CoffeeAddict19

      Basically what I'm trying to do is add the functionality to let the user select a JPEG background image for my game, as eye candy. MFC has functions for handling bitmaps but nothing for JPEGs or other image formats. I'd like to load a JPEG and convert it to a bitmap so that I can blit it as necessary. What is the best way to do this? I'd rather do it without tacking on a huge library to my program, if possible.

      J Offline
      J Offline
      Joe Woodbury
      wrote on last edited by
      #2

      Look at the GDI+ library. If you are aiming only at Windows XP, it ships with the DLL.

      Anyone who thinks he has a better idea of what's good for people than people do is a swine. - P.J. O'Rourke

      1 Reply Last reply
      0
      • C CoffeeAddict19

        Basically what I'm trying to do is add the functionality to let the user select a JPEG background image for my game, as eye candy. MFC has functions for handling bitmaps but nothing for JPEGs or other image formats. I'd like to load a JPEG and convert it to a bitmap so that I can blit it as necessary. What is the best way to do this? I'd rather do it without tacking on a huge library to my program, if possible.

        H Offline
        H Offline
        Hamid Taebi
        wrote on last edited by
        #3

        You can use of CImage class for load jpg file.


        WhiteSky


        1 Reply Last reply
        0
        • C CoffeeAddict19

          Basically what I'm trying to do is add the functionality to let the user select a JPEG background image for my game, as eye candy. MFC has functions for handling bitmaps but nothing for JPEGs or other image formats. I'd like to load a JPEG and convert it to a bitmap so that I can blit it as necessary. What is the best way to do this? I'd rather do it without tacking on a huge library to my program, if possible.

          M Offline
          M Offline
          Mark Salsbery
          wrote on last edited by
          #4

          CoffeeAddict19 wrote:

          I'd like to load a JPEG and convert it to a bitmap so that I can blit it as necessary.

          If you use GDI+ it's pretty simple...

          // Assuming GDI+ is initialized...

          Gdiplus::Bitmap SrcBitmap(L"C:\\Images\\MyJPEG.jpg", FALSE);
          HBITMAP hBitmap;
          SrcBitmap.GetHBITMAP(Gdiplus::Color(0xFF,0xFF,0xFF), &hBitmap);

          C 1 Reply Last reply
          0
          • M Mark Salsbery

            CoffeeAddict19 wrote:

            I'd like to load a JPEG and convert it to a bitmap so that I can blit it as necessary.

            If you use GDI+ it's pretty simple...

            // Assuming GDI+ is initialized...

            Gdiplus::Bitmap SrcBitmap(L"C:\\Images\\MyJPEG.jpg", FALSE);
            HBITMAP hBitmap;
            SrcBitmap.GetHBITMAP(Gdiplus::Color(0xFF,0xFF,0xFF), &hBitmap);

            C Offline
            C Offline
            CoffeeAddict19
            wrote on last edited by
            #5

            Thanks.

            1 Reply Last reply
            0
            • C CoffeeAddict19

              Basically what I'm trying to do is add the functionality to let the user select a JPEG background image for my game, as eye candy. MFC has functions for handling bitmaps but nothing for JPEGs or other image formats. I'd like to load a JPEG and convert it to a bitmap so that I can blit it as necessary. What is the best way to do this? I'd rather do it without tacking on a huge library to my program, if possible.

              T Offline
              T Offline
              ThatsAlok
              wrote on last edited by
              #6

              CoffeeAddict19 wrote:

              I'd like to load a JPEG and convert it to a bitmap so that I can blit it as necessary. What is the best way to do this? I'd rather do it without tacking on a huge library to my program, if possible.

              http://www.codeproject.com/bitmap/extendedbitmap2.asp

              "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

              cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Re

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups