Solved

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

Posted on 1998-03-28
2
354 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 100 total points
ID: 1317315
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
ID: 1317316
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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. …
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.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

623 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