Posted by
Robert Rohland on
Nov 14, 2005; 4:00am
URL: http://imagej.273.s1.nabble.com/24-bit-RGB-to-16-bit-gray-conversion-tp3704473p3704474.html
Art -
Not too difficult. Gray scale is just the average of the red, green, and
blue channels. If you have 16 bits (65,536 levels) to work with, you can
simply add the red, green, and blue channels and scale them up however you
like.
Here's how to do one manually:
I just opened the baboon.jpg, a 24-bit RGB. Select the baboon window. Then
select the menu command Image / Color / RGB Split. The colorful baboon will
go away and you will see three new windows entitled baboon.jpg (red),
baboon.jpg (green), and baboon.jpg (blue). Each is 8-bit gray scale.
First, you have to convert each of these 8-bit (256 levels) images to
16-bits (65536 levels). Select "baboon.jpg (red)." Select menu command Image
/ Type / 16-bit. Do the same with the green and blue 8-bit channels.
Converting to 16-bits before doing math will prevent overflow.
Now select menu command Process / Image Calculator. In the dialog box,
select "baboon.jpg (red)" for Image1, "Add" for Operation, and "baboon.jpg
(green)" for Image2. Check the "Create New Window" checkbox and hit OK.
You will get a new window entitled "Result of baboon.jpg," which will be a
16-bit result.
Now run the Image calculator again to add in the "baboon.jpg (blue)" layer.
You will a new image called "Result of Result." This is your 16-bit
grayscale image. Since you just added three 256-level images together, the
maximum will be 765. You can scale this up by selecting menu command Process
/ Math / Multiply. A dialog box will ask you for the multiplier. The biggest
multiplier you can use is 85 before you overflow the 16-bit maximum of
65535.
If you need to adjust the brightness and contrast, use Image / Adjust /
Brightness/Contrast.
If you have a whole bunch of pictures to do, make a macro using this
sequence of commands.
- Robert M. Rohland
[hidden email]
[hidden email]
146 Garner Circle
Montrose MN 55363
763-675-8905
612-226-9735 (cell)
----- Original Message -----
From: "ij-Newsgroup" <
[hidden email]>
To: <
[hidden email]>
Sent: Sunday, November 13, 2005 3:54 PM
Subject: 24 bit RGB to 16 bit gray conversion?
> Does anyone know how to convert a 24 bit RGB image (16.7 million
> colours) into a 16 bit grayscale image?
>
> Thanks
> Art