How to change BMP file to JPEG/JPG file using VC++/C++

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • visweswaran2830
    New Member
    • Nov 2009
    • 92

    How to change BMP file to JPEG/JPG file using VC++/C++

    Hi,

    I have created one application using vc++. In that, I captured and stored desktop image as bmp image format, now i want to convert it into jpeg/jpg format in vc++/c++. How can I do this......
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    Either you get and read the jpeg specification and write a jpeg encoder yourself or you find a third party library at a cost you are willing to pay and use that to write out your jpeg files.

    I have never had to output jpegs so I have no library recomendations, sorry.

    Comment

    • Airslash
      New Member
      • Nov 2007
      • 221

      #3
      use the GDI functions from the Graphics namespace if you're on .NET or link against the gdi32 dll and use the direct GDI functions.

      then you have the opportunity to load images as bmp or jpg and save them as bmp or jpg. You can even work with em and manipulate em.

      and GDi is pretty fast as well since it works partially on the hardware instead of the CPU

      Comment

      • johny10151981
        Top Contributor
        • Jan 2010
        • 1059

        #4
        Dear Airslash,
        can you please explain this line.
        GDi is pretty fast as well since it works partially on the hardware instead of the CPU

        This line fly away over my head like a rocket before i have understood anything at all.

        Regards,
        Johny

        Comment

        • Airslash
          New Member
          • Nov 2007
          • 221

          #5
          Sure,

          we are currently using these technologies for our software here at work and the difference is that when you use the standard classes such as a memory stream and other input/output methods for reading the data of a image and then manipulate it, you do this using the processor.

          If you use GDI, these things are done on the hardware of the graphics card, The GPU.

          To give an example, we resized a jpg from 3megapixels to standard VGA. using a Duel Core cpu we needed about 26 miliseconds to do this. Using GDI and CUDA technologies we only need 6 miliseconds.

          Thats what I ment with beeing faster on the hardware.

          Comment

          • johny10151981
            Top Contributor
            • Jan 2010
            • 1059

            #6
            Airslash,
            Thank you for these information.
            I am asking you again this GDI is only blong to .net or under GDI 32?

            Comment

            • Airslash
              New Member
              • Nov 2007
              • 221

              #7
              both.

              you can use GDI directly by linking against the lib and dll supplied by Windows, or you can use the Graphics namespace in .NET

              look up GDI on the msdn, it has complete articles and guides on how to use it

              Comment

              Working...