Announcement

Collapse
No announcement yet.

bitmap files

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • bitmap files

    I want to manipulate pixels in a bitmap and have been lookind at BITMAPFILEHEADER and BITMAPINFOHEADER details of a number of .bmp files. I had expected .BiSizeImage to be the same as .BiWidth * .BiHeight * Bytes per color.
    However I find that this is not always so, usually it is bigger by 1,2 or 3 lines on one file it was a part line bigger. When the pixel array is set up are these extra pixels ignored or padded or should the BiHeight value be adjusted.

  • #2
    Width must be divisible by 2 (rounded up), so a 24-bit image 99x100 is not 29700, but 30000 bytes in size, you can use MOD to do the calculation.

    Image handling code gets a bit more interesting with bitmaps that are 16bpp or below as there is a color table before the image data as well, which size has to be calculated (nColors * SIZEOF(RGBQUAD)), even some 16bpp images have this to "translate" some colors into the 65556 available.
    kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

    Comment


    • #3
      Thanks Kev. But there must be more going on. What about this example

      BiSizeImage = 32844 (24 bit colour)
      biWidth = 158
      BiHeight = 69

      Iain

      Comment


      • #4
        Thanks Kev. But there must be more going on. What about this example

        BiSizeImage = 32844 (24 bit colour)
        biWidth = 158
        BiHeight = 69

        Iain

        Comment


        • #5
          I don't know what the extra 138 bytes are for. Could be custom data. Have you tried allocating the (158 * 169) * 3 byte array, extracting this chunk from the file and displaying the image with the SetDIBits function?

          The image data should be last part of the chunk, so if you have a 200 byte data block and need image data that is 100 bytes, you skip the first 100 bytes in the block.

          I haven't written any DIB code for a while so this may be off the mark.
          kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

          Comment

          Working...
          X