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. read/write BMP,JPG,GIF file ?

read/write BMP,JPG,GIF file ?

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
5 Posts 3 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.
  • _ Offline
    _ Offline
    _skidrow_vn_
    wrote on last edited by
    #1

    Can you help me or show me where have source code to do this I want read/write BMP,JPG,GIF file more detail: I will capture all screen .....after then save it in BMP,JPG,GIF format thank you very much :):rose:

    C 1 Reply Last reply
    0
    • _ _skidrow_vn_

      Can you help me or show me where have source code to do this I want read/write BMP,JPG,GIF file more detail: I will capture all screen .....after then save it in BMP,JPG,GIF format thank you very much :):rose:

      C Offline
      C Offline
      Chris Losinger
      wrote on last edited by
      #2

      http://www.codeproject.com/bitmap/ ImgSource | CheeseWeasle

      J 1 Reply Last reply
      0
      • C Chris Losinger

        http://www.codeproject.com/bitmap/ ImgSource | CheeseWeasle

        J Offline
        J Offline
        Johann Gerell
        wrote on last edited by
        #3

        Chris, I'm using your JpegFile[^] class - excellent! - and have recently been forced to stretch blit HBITMAPs created from Jpeg files. However, this results in skewed images. Plain blitting works fine, but since stretching skewes the image, I wonder if there might be data alignment issues. I create the HBITMAP like this (only a snippet - allocated memory is deleted, I promise...):

        UINT width, height;
        LPBYTE pData = JpegFile::JpegFileToRGB(filename, &width, &height);
        JpegFile::BGRFromRGB(pData, width, height);
        UINT widthBytes;
        LPBYTE pDataAligned = JpegFile::MakeDwordAlignedBuf(pData, width, height, &widthBytes);
        HBITMAP hBmp = ::CreateBitmap(width, height, 1, 24, (PVOID)pDataAligned);

        Should I create a DIB section instead? If so, why? Can you see something else, which is completely and utterly crazy? Thanks for any input! -- Human beings, who are almost unique in having the ability
        to learn from the experience of others, are also remarkable
        for their apparent disinclination to do so. (Douglas Adams)

        C 1 Reply Last reply
        0
        • J Johann Gerell

          Chris, I'm using your JpegFile[^] class - excellent! - and have recently been forced to stretch blit HBITMAPs created from Jpeg files. However, this results in skewed images. Plain blitting works fine, but since stretching skewes the image, I wonder if there might be data alignment issues. I create the HBITMAP like this (only a snippet - allocated memory is deleted, I promise...):

          UINT width, height;
          LPBYTE pData = JpegFile::JpegFileToRGB(filename, &width, &height);
          JpegFile::BGRFromRGB(pData, width, height);
          UINT widthBytes;
          LPBYTE pDataAligned = JpegFile::MakeDwordAlignedBuf(pData, width, height, &widthBytes);
          HBITMAP hBmp = ::CreateBitmap(width, height, 1, 24, (PVOID)pDataAligned);

          Should I create a DIB section instead? If so, why? Can you see something else, which is completely and utterly crazy? Thanks for any input! -- Human beings, who are almost unique in having the ability
          to learn from the experience of others, are also remarkable
          for their apparent disinclination to do so. (Douglas Adams)

          C Offline
          C Offline
          Chris Losinger
          wrote on last edited by
          #4

          the docs for CreateBitmap say that the image has to be WORD-aligned, not DWORD-aligned. so, that could be a problem. i typically use CreateDIBitmap or CreateDIBSection. have you tried either of those? -c ImgSource | CheeseWeasle

          J 1 Reply Last reply
          0
          • C Chris Losinger

            the docs for CreateBitmap say that the image has to be WORD-aligned, not DWORD-aligned. so, that could be a problem. i typically use CreateDIBitmap or CreateDIBSection. have you tried either of those? -c ImgSource | CheeseWeasle

            J Offline
            J Offline
            Johann Gerell
            wrote on last edited by
            #5

            As I'm on Windows CE, CreateDIBitmap isn't an option, but CreateDIBSection() solved it. See an elaborate scheme in another thread[^]. Thanks! -- Human beings, who are almost unique in having the ability
            to learn from the experience of others, are also remarkable
            for their apparent disinclination to do so. (Douglas Adams)

            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