how to convert 16 bpp image to 4 bpp image ?

how to convert 16 bpp image to 4 bpp image ?

Post by jdlee1 » Fri, 19 Nov 1999 04:00:00


I live in seoul korea  ..
and I need help ..

I capture  desktop  screen  (16 or 24   bit per pixel in color depth) .
and I want to convert it to  4 bit per pixel ( 16 color )  image ( 16
color DIB ) .

let me know  how to do it ..

thanks .



 
 
 

how to convert 16 bpp image to 4 bpp image ?

Post by Petr Novotn » Fri, 19 Nov 1999 04:00:00



Quote:> I live in seoul korea  ..
> and I need help ..

> I capture  desktop  screen  (16 or 24   bit per pixel in color depth) .
> and I want to convert it to  4 bit per pixel ( 16 color )  image ( 16
> color DIB ) .

1. Learn how to work with DIBs (how to create and index 4bpp and 16/24bpp
bit).
2. Trace over the 16/24bpp DIB. For every pixel
3. Find the nearest color in the 4bpp palette
4. and set the pixel into the 4bpp DIB.

You might want to do some dithering (Floyd-Steinberg comes to mind),
otherwise the result will be too ugly. The speed-limiting factors will be
the find_narest_color step, and F-S dithering step.

Alternatively, pay someone to do that for you, or buy a ready-made library
which does that.

 
 
 

1. How to convert a 32 bit per pixel (bpp) image to an 8 bpp image

    I have been using the .NET framework to get icons for files/directories
and am trying to save the icons as transparent gifs.  Now I know that most
of the graphics routines in .NET are built on top of GDI/GDI+, so that is
why I am asking the question in these forums.

    I can get a handle to an icon just fine.  I can even convert it to a
transparent bitmap just fine.  However, this bitmap is 32 bits per pixel.
When I want to save this as a transparent gif, I cannot, because the
specification calls for a max of 8bpp.

    So, given that, how can I convert or create a new bitmap that I can save
as a transparent gif, but reducing the resolution to 8bpp?

    Thanks in advance for any help, it is greatly appreciated.

--
               - Nicholas Paldino [.NET MVP]

2. Dave Barnhart

3. CreateDIBSection(): DirectDraw Surface bpp != Display bpp

4. CORBA and Unix and Web Servers

5. Loading 32 bpp images with GDI+

6. Reverse Engineering

7. Printing 8 bpp Images

8. Problem with OpenDialog

9. Printing 24 bpp images on VC++ 6.0

10. Create a device context with 8,16,24,32 bpp manually

11. Color remapping animation in 16/32 bpp

12. 15/16 bpp screen mode and DIB

13. Unchained (16 BPP) graphics mode Q's....