Solved

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

Posted on 1998-03-28
2
347 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how do i create updater to My Activex application? 3 79
Smart Camera scanning and reading information 3 99
firstChar challenge 13 106
Not needed 13 93
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: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

919 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

22 Experts available now in Live!

Get 1:1 Help Now