Click here to Skip to main content
15,881,898 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
to convert 8-bit grayscale images into 36-bits per pixel in RGB. How can you perform the conversion and make sure the new RGB images are visually identical to the original grayscale images?

What I have tried:

well i was thinking of multiplying the 3-3-2 channel in 8 bit image by 4-4-6 respectively. but i am not sure if the if i am going in a correct direction
Posted
Updated 1-May-20 3:31am

1 solution

A 8-bits "colour" has 256 possible values, from 0 to 255, to represent a grayscale.
A 36-bits colour has 12 bits per channel, assuming no transparency.
You can map the 8-bits value to its 12-bits equivalent, and assign this 12-bits values to all channels:
C#
// This is pseudocode
int channelValue = grayscaleValue << 4; // This means channelValue = grayScaleValue * 16
the36bitsColour = new Colour(channelValue, channelValue, channelValue);
 
Share this answer
 
Comments
OriginalGriff 1-May-20 12:36pm    
Do you think he realises that his image will still be monochrome? :D
phil.o 1-May-20 13:01pm    
I've been wondering, just waiting for some basic feedback to spot the obvious, if needed :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900