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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Screen Capturing in JPG format and not Bitmap

Screen Capturing in JPG format and not Bitmap

Scheduled Pinned Locked Moved C / C++ / MFC
graphicssysadmin
11 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.
  • D Offline
    D Offline
    Dhiraj kumar Saini
    wrote on last edited by
    #1

    I want to make a screen capturing application which captures and stores in JPG or GIF format and not in Bitmap format. I have examples from codeproject but all of them are using Bitmap b'coz of which when i save themin a bitmap file for sending to the server the file size if too much. Thanks & Regards. Dhiraj Kumar Saini

    R C A 3 Replies Last reply
    0
    • D Dhiraj kumar Saini

      I want to make a screen capturing application which captures and stores in JPG or GIF format and not in Bitmap format. I have examples from codeproject but all of them are using Bitmap b'coz of which when i save themin a bitmap file for sending to the server the file size if too much. Thanks & Regards. Dhiraj Kumar Saini

      R Offline
      R Offline
      Rajesh R Subramanian
      wrote on last edited by
      #2

      You can convert the bitmap to a JPG and then...

      It is a crappy thing, but it's life -^ Carlo Pallini

      D 1 Reply Last reply
      0
      • R Rajesh R Subramanian

        You can convert the bitmap to a JPG and then...

        It is a crappy thing, but it's life -^ Carlo Pallini

        D Offline
        D Offline
        Dhiraj kumar Saini
        wrote on last edited by
        #3

        If you can provide some code or example as to how ro convert it would of great help.

        R 1 Reply Last reply
        0
        • D Dhiraj kumar Saini

          I want to make a screen capturing application which captures and stores in JPG or GIF format and not in Bitmap format. I have examples from codeproject but all of them are using Bitmap b'coz of which when i save themin a bitmap file for sending to the server the file size if too much. Thanks & Regards. Dhiraj Kumar Saini

          C Offline
          C Offline
          Code o mat
          wrote on last edited by
          #4

          Use GDI+ to save to JPG. Once you have a HBITMAP containing the screenshot do Something like this (can't remember the correct objects/methods now so you will have to look them up, but it generally goes something like this):

          Gdiplus::Bitmap Img; //or maybe Gdiplus::Image...
          Img.Attach(hbitmap_screenshot); //or fromHBITMAP()...
          Img.Save(path_to_save_to, Gdiplus::ImageFormatJPEG);
          Img.Detach();

          > The problem with computers is that they do what you tell them to do and not what you want them to do. <

          D 1 Reply Last reply
          0
          • D Dhiraj kumar Saini

            If you can provide some code or example as to how ro convert it would of great help.

            R Offline
            R Offline
            Rajesh R Subramanian
            wrote on last edited by
            #5

            If you are using MFC, you could use CImage::Save() with ImageFormatJPEG or ImageFormatGIF as the guidFileType field.

            C D 3 Replies Last reply
            0
            • R Rajesh R Subramanian

              If you are using MFC, you could use CImage::Save() with ImageFormatJPEG or ImageFormatGIF as the guidFileType field.

              C Offline
              C Offline
              CPallini
              wrote on last edited by
              #6

              Rajesh R Subramanian wrote:

              If you are using MFC

              Hey man, you're using your superpowers. :-D

              If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
              This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
              [My articles]

              R 1 Reply Last reply
              0
              • C Code o mat

                Use GDI+ to save to JPG. Once you have a HBITMAP containing the screenshot do Something like this (can't remember the correct objects/methods now so you will have to look them up, but it generally goes something like this):

                Gdiplus::Bitmap Img; //or maybe Gdiplus::Image...
                Img.Attach(hbitmap_screenshot); //or fromHBITMAP()...
                Img.Save(path_to_save_to, Gdiplus::ImageFormatJPEG);
                Img.Detach();

                > The problem with computers is that they do what you tell them to do and not what you want them to do. <

                D Offline
                D Offline
                Dhiraj kumar Saini
                wrote on last edited by
                #7

                Thanks Its Working :)

                1 Reply Last reply
                0
                • R Rajesh R Subramanian

                  If you are using MFC, you could use CImage::Save() with ImageFormatJPEG or ImageFormatGIF as the guidFileType field.

                  D Offline
                  D Offline
                  Dhiraj kumar Saini
                  wrote on last edited by
                  #8

                  Thanks its working!

                  1 Reply Last reply
                  0
                  • C CPallini

                    Rajesh R Subramanian wrote:

                    If you are using MFC

                    Hey man, you're using your superpowers. :-D

                    If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                    This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                    [My articles]

                    R Offline
                    R Offline
                    Rajesh R Subramanian
                    wrote on last edited by
                    #9

                    Well, my CPMRU is fully charged. :-D

                    It is a crappy thing, but it's life -^ Carlo Pallini

                    1 Reply Last reply
                    0
                    • D Dhiraj kumar Saini

                      I want to make a screen capturing application which captures and stores in JPG or GIF format and not in Bitmap format. I have examples from codeproject but all of them are using Bitmap b'coz of which when i save themin a bitmap file for sending to the server the file size if too much. Thanks & Regards. Dhiraj Kumar Saini

                      A Offline
                      A Offline
                      A_xin
                      wrote on last edited by
                      #10

                      you can use CxImage class.CxImage is a C++ class to load, save, display, transform BMP, JPEG, GIF, PNG, TIFF, MNG, ICO, PCX, TGA, WMF, WBMP, JBG, J2K images

                      1 Reply Last reply
                      0
                      • R Rajesh R Subramanian

                        If you are using MFC, you could use CImage::Save() with ImageFormatJPEG or ImageFormatGIF as the guidFileType field.

                        D Offline
                        D Offline
                        Dhiraj kumar Saini
                        wrote on last edited by
                        #11

                        I am able to save it in JPG format but the size of the file is somewhere around 150KB. Is there any way I can Optimize the size to somewhere below 100KB as it needs to be sent to the server for real time monitoring. Thanks In Advance

                        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