Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 1998-03-28
2
Medium Priority
?
355 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 200 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

Industry Leaders: 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

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

670 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