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. Converting 32 bit bitmap image to 24 bit bitmap image

Converting 32 bit bitmap image to 24 bit bitmap image

Scheduled Pinned Locked Moved C / C++ / MFC
graphicsquestionlearning
4 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.
  • H Offline
    H Offline
    hasansheik
    wrote on last edited by
    #1

    Hi, I am loading one BMP image from Resource file using CBitmaps::LoadBitmap() function. actually it is 24 bit image but if I use GetBitmap function of CBitmap to see the properties of the Bitmap the it shows the number of bits per pixel column as 32 bits. how come it is. I want to convert this 32 bit image to 24 bit image. please let me know the how can i do that Thanks in Advance

    B 1 Reply Last reply
    0
    • H hasansheik

      Hi, I am loading one BMP image from Resource file using CBitmaps::LoadBitmap() function. actually it is 24 bit image but if I use GetBitmap function of CBitmap to see the properties of the Bitmap the it shows the number of bits per pixel column as 32 bits. how come it is. I want to convert this 32 bit image to 24 bit image. please let me know the how can i do that Thanks in Advance

      B Offline
      B Offline
      Bob Stanneveld
      wrote on last edited by
      #2

      Hello, The reason that the bitmap is 32 bpp instread of 24 is because of memory alignment. Pentium processors work faster when data is aligned at 4 bytes (32 bits). Data that isn't aligned at multiple of 32 bits will wreck havoc on the Pentium processor. The other reason for this alignment is that the most graphics cards don't support true 24 bit color modes. The reason for this is the same as for the Pentium. Also there are no api's that can copy 3 bytes of memory at once. So for optimizing purposes the momory is aligned at 32 bits. So you don't need to worry about the 32 bpp since the extra 8 bits are for your own good... Hope this information was of any help.:)

      A student knows little about a lot. A professor knows a lot about little. I know everything about nothing.

      A 1 Reply Last reply
      0
      • B Bob Stanneveld

        Hello, The reason that the bitmap is 32 bpp instread of 24 is because of memory alignment. Pentium processors work faster when data is aligned at 4 bytes (32 bits). Data that isn't aligned at multiple of 32 bits will wreck havoc on the Pentium processor. The other reason for this alignment is that the most graphics cards don't support true 24 bit color modes. The reason for this is the same as for the Pentium. Also there are no api's that can copy 3 bytes of memory at once. So for optimizing purposes the momory is aligned at 32 bits. So you don't need to worry about the 32 bpp since the extra 8 bits are for your own good... Hope this information was of any help.:)

        A student knows little about a lot. A professor knows a lot about little. I know everything about nothing.

        A Offline
        A Offline
        Ayman Kouzayha
        wrote on last edited by
        #3

        same question i will ask, and the answer of you Mr is not enough, i want to convert from 32bits bimap to 24bits because i am using an engine supports only 24bits bitmap, the conversation is at C# level, any information is more than welcomed.

        B 1 Reply Last reply
        0
        • A Ayman Kouzayha

          same question i will ask, and the answer of you Mr is not enough, i want to convert from 32bits bimap to 24bits because i am using an engine supports only 24bits bitmap, the conversation is at C# level, any information is more than welcomed.

          B Offline
          B Offline
          Bob Stanneveld
          wrote on last edited by
          #4

          Hi, Interesting that you found my reply of more than 6 years ago :). I can't help you here. Try posting your question in the C# section. Also try to elaborate on the ways that you've explored so far. Kind regards, Bob Stanneveld

          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