• Status: Solved
• Priority: Medium
• Security: Public
• Views: 560

# raw image to bmp,tiff

Hi everybody

I have a b/w 10-bit raw image and I need to create a image file in a standard format (bmp or tiff). How can I convert 10-bit to any other (16-bit, 24-bit)? Where can I get specifications to do that? By the way, I using java to develop the application.
0
alfarod
1 Solution

Commented:
Regarding my answer to this question:
http://www.experts-exchange.com/Programming/Q_20542177.html

There is an easier and faster way to convert 10 bit to 16 or whatever. Though it is not a precise conversion it might be suitable for your needs.
Take those 10 bits and add zero's to the end till you got 16, 24, .... So basicaly you shift the 10 bit to the right to create 16 bit.

The formula that coresponds with this is:
value16 = value10 * 2^16/2^10 = value10 * 2^6 (or righshift  value10 6 times)

The correct formula should be:
value16 = value10 + (2^16 - 1)/(2^10 - 1)

But since 1 is realtivily small compared to 2^16 or even 2^10, it can be ignored. But this of course depends on the application you want to have. Just for visualisation it is more than enough.

I'm not very familiar with the BMP but I do believe that it consistes of 8 bit values of the 3 major colours: Red, Green and Blue. For gray you need an equal amount of each colour. So what you probably need to do is convert your 10 bit image to an 8 bit image since you need 8 bit for each colour. In this case I do recomend to use the correct formula as described above. You might even want to do some filtering to smoothen the image.

There might be some other standards that support 16 bit grayscale (or 24 bit grayscale) bit I doubt that the bmp format supports this.

kind regards,
Jan
0

## Featured Post

Tackle projects and never again get stuck behind a technical roadblock.