Solved

How to convert 24-bit DIB to 4-bit DIB ?

Posted on 1998-03-28
2
346 Views
Last Modified: 2013-11-20
If I save a 24-bit DIB as .BMP-file it's about 1.8 MB large. I don't have so much colors in the DIB so it gives also enough good results to reduce to 4-bit colors. I tried it with MS-PAINT. MS-Paint allows you to convert to 4 bit and the result is very good and the file-size reduces to nearly 300 kB. Is there anywhere source-code in VC++ in doing this converting from own programs written in C++ ?

Thanks a lot
0
Comment
Question by:atari
2 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 100 total points
Comment Utility
The idea is that you have 16 colors to which map everything else. The bad thing about this is that the 16 colors are already chosen for you. They exists in the standard VGA color palette. So basically, for every RGB you have, you need to figure out the distance between that RGB with the RGB of the standard colors to see which it is closest to. Then you change that RGB to the standard color.


0
 
LVL 1

Author Comment

by:atari
Comment Utility
I've heard upon that, you have 20 ground colors in the standard-palette and the routines you find  for converting are calculating the "nearest colors". I've seen sample-code for that. But this is not the main problem. In the 24-bit-DIB the color information is inside the pixels and there is no color palette. If I want to reduce the DIB to 16 colors I need a color-palette, there I found somewhere in MSJ a sample-code "palette generator", but the main problem is to filter out the color-information out of the pixels, that include also the color-information if you have a 24-bit-DIB. Some sample-code would be very nice. There can nothing be found around the whole internet. I tested also Paint Shop Pro and this program also reduces the colors in a fine way. There must be some sample-code for it.

Thanks,
atari
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
bobThere java chalenge 45 82
Define unique primary key 9 81
scoreUp challenge 14 47
wordappend challenge 8 83
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video discusses moving either the default database or any database to a new volume.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now