Author Topic: Image Color Depths  (Read 6716 times)

Alhexx

  • *
  • Posts: 1894
    • View Profile
    • http://www.alhexx.com
Image Color Depths
« on: 2005-11-13 14:33:25 »
I've continued working on BrutePix, my raw image viewer. Basically, it works, however, I need a bit help with the different image color depths...

But first, I'll post which bit depths are currently supported:

Legend:
W -> White (i.e. Grayscale)
R -> Red
G -> Green
B -> Blue
A -> Alpha


High-Color Pixel Depths:
  • 4 Bit [RGBA-1111]
  • 8 Bit [RGBA-2222]
  • 12 Bit [RGBA-3333]
  • 12 Bit [RGB-444]
  • 16 Bit [RGBA-4444]
  • 16 Bit [RGBA-5551]
  • 16 Bit [RGB-565]
  • 24 Bit [RGB-888]
  • 32 Bit [RGBA-8888][/list:u]

    GrayScale Pixel Depths:
    • 1 Bit [W-1]
    • 4 Bit [W-4]
    • 8 Bit [W-8][/list:u]

      Palette Pixel Depths:
      • 1 Bit [2 Colors]
      • 2 Bit [4 Colors]
      • 4 Bit [16 Colors]
      • 8 Bit [256 Colors]
      • 12 Bit [4096 Colors]
      • 16 Bit [65K Colors][/list:u]

        Miscelaneous:
        • DXT1 Compression [4x4 Pixels - 64 Bit]
        • DXT2/3 Compression [4x4 Pixels - 128 Bit]
        • DXT4/5 Compression [4x4 Pixels - 128 Bit][/list:u]

          My first question is:
          Does anyone know any other common image formats? I read a something of 12-bit grayscale, however, I couldn't find any images.

          The second question:
          I need some images for testing. Does anyone have any images in one of these formats:
          • 4 Bit High-Color [RGBA-1111]
          • 8 Bit High-Color [RGBA-2222]
          • 12 Bit High-Color [RGBA-3333]
          • 12 Bit High-Color [RGB-444]
          • 12 Bit GrayScale [W-12]
          • 12 Bit Paletted [4096 Colors]
          • 16 Bit Paletted [65K Colors][/list:u]

             - Alhexx

Qhimm

  • Founder
  • *
  • Posts: 1996
    • View Profile
    • Qhimm.com
Image Color Depths
« Reply #1 on: 2005-11-13 14:38:08 »
Well if you want to make it really useful, you could let the user input a custom color type, maybe like OpenGL does it (combined packed storage size, individual component bit offset+length)... Possibly let the user store different custom formats as settings, too. That way you wouldn't need to hard-code the generic color formats, and could focus on the trickier ones (like compressed or floating-point or whatever). Maybe also implement support for different colorspaces (i.e. channel interpretations), which happens to be what I'm coding at the moment. :P

Alhexx

  • *
  • Posts: 1894
    • View Profile
    • http://www.alhexx.com
Image Color Depths
« Reply #2 on: 2005-11-13 16:07:15 »
Hm, that custom color type thing seems to be an interesting idea. I will try to implement that, too.
However, having hard-coded standard types is good, too, since BrutePix renders in real-time. So the image is not converted to a nice format as 32bit rgba and displayed afterwards; it calculates every single pixel every single time it is needed.

 - Alhexx

Micky

  • *
  • Posts: 300
    • View Profile
Re: Image Color Depths
« Reply #3 on: 2005-11-13 16:09:42 »
Quote
Does anyone know any other common image formats?

The GameCube GPU supports a format called RGB5A3.  That is RGBA5551 for opaque pixels and RGBA4443 for transparent pixels.
And there is the RGBX888 format, which is a 32-bit aligned RGB format.

Alhexx

  • *
  • Posts: 1894
    • View Profile
    • http://www.alhexx.com
Image Color Depths
« Reply #4 on: 2005-11-13 20:24:48 »
Ah, yeah, I remember that RGB555A3 one... I'll see if I implement that, too.
As for RGBX888 - that's simply 32 Bit RGBA, but without Alpha channel....

Thanx.

 - Alhexx

Cyberman

  • *
  • Posts: 1572
    • View Profile
Image Color Depths
« Reply #5 on: 2005-11-14 01:51:10 »
There is also R10G10B10A2 as well.
Hmmm maybe you could have an output based on a a bits stream and define the bitstream information using some sort of XML based data file.  This way the 'file' setup is transportable or definable externally.  Of course that would mean a lot of work now that I think about it :D

Cyb

mirex

  • *
  • Posts: 1645
    • View Profile
    • http://mirex.mypage.sk
Image Color Depths
« Reply #6 on: 2005-11-14 10:17:31 »
Bitmap_GrayAlpha88,                   // 2 bytes / pixel
        Bitmap_RGB565,                          // 2 bytes / pixel
        Bitmap_RGB555,                          // 2 bytes / pixel
        Bitmap_BGR565,                          // 2 bytes / pixel
   Bitmap_BGR555,            // 2 bytes / pixel
        Bitmap_RGBA5551,                      // 2 bytes / pixel
        Bitmap_BGRA5551,         // 2 bytes / pixel
        Bitmap_BGRA5551_Aflip,         // 2 bytes / pixel alpha flipped (needed for TGA)
        Bitmap_BGRA4444,                      // 2 bytes / pixel
        Bitmap_RGB888,                          // 3 bytes / pixel
        Bitmap_BGR888,                          // 3 bytes / pixel (needed for BMP)
        Bitmap_RGBA8888,                      // 4 bytes / pixel
        Bitmap_BGRA8888,                      // 4 bytes / pixel
        Bitmap_ARGB8888,                      // 4 bytes / pixel (needed for TXMP)


These are formats I use in Biturn bitmap lib. In these formats were stored files I encountered so far ( if i don't count DXT and RLE encodings ).

When I was trying to use PNGlib ( http://libpng.org/pub/png/libpng.html ) I found an example pictures somewhere in the archives. They are stored in various pixel depths, check them out.

Alhexx

  • *
  • Posts: 1894
    • View Profile
    • http://www.alhexx.com
Image Color Depths
« Reply #7 on: 2005-11-14 16:47:55 »
Cyberman:
I'll implement that RGB10A2 format, too.
I'm currently working on Qhimm's idea of letting the user add custom types, which will give BrutePix a bigger palette of possible formats.

I'm just trying to add some more hard coded ones, since the hard coded algorithms are optimized, so they will work a lot faster than the custom ones.

mirex:
The order of the Blue and Red byte does not matter, since BrutePix has an option to swap the red and blue values.
As for  Bitmap_ARGB8888, this is needed because Oni's TXMP format is byte-swapped since Oni was developed for Mac.

I'm also thinking about implementing a Byte-swapping option, too.

 - Alhexx