Welcome to Dream.In.Code
Become a C++ Expert!

Join 149,548 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,554 people online right now. Registration is fast and FREE... Join Now!




how to convert a .bmp file (256 color) into grayscale image.

 
Reply to this topicStart new topic

how to convert a .bmp file (256 color) into grayscale image.

sourabh009
30 Oct, 2007 - 03:42 AM
Post #1

New D.I.C Head
*

Joined: 30 Oct, 2007
Posts: 3


My Contributions
hi, i want to know 1 more thing that how to convert a .bmp file (256 color) into grayscale image.
User is offlineProfile CardPM
+Quote Post

Trogdor
RE: How To Convert A .bmp File (256 Color) Into Grayscale Image.
30 Oct, 2007 - 07:35 AM
Post #2

D.I.C Addict
Group Icon

Joined: 6 Oct, 2006
Posts: 549



Thanked: 4 times
Dream Kudos: 125
My Contributions
Do you have a library/routine to read and write the image ?
If you have a bitmap in memory it is quite simple to convert the RGB values in greyscale. You could for example take the average value of each pixels R G and B values (not very accurate, but very simple and fast) or use a more advanced method that tries to figure out the luminosity of the pixel. (think pythagoras' equation)

User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 1/7/09 09:37PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month