Hi all,
I have an image with 12bit/pixel data. That is, the pixel values range from 0 to 2^12-1.
But the pixel is stored in two bytes. (16 bits out of which only 12 bits are valid)
Is there a way I can make convert to process only 12 bits and not entire 16 bits ?
Because I tried using enhance using "depth 16" option and it has generated output whose values range from 0 to 65535. But I want the output also to restrict to 12 bits.
Which convert option can be used ? Depth doesn't seem be correct option.
Thanks!
convert specify the valid range of pixel values
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: convert specify the valid range of pixel values
What processing do you want to do?
If the input is 12-bits/channel/pixel but stored in 16 bits, and you want the same for output, then there is no problem. No conversion is needed. The only oddity is that the top or bottom four bits will be zero.
If the top 4 bits are zero and you want to convert to 16 bits, you could multiply by 16.
If the input is 12-bits/channel/pixel but stored in 16 bits, and you want the same for output, then there is no problem. No conversion is needed. The only oddity is that the top or bottom four bits will be zero.
If the top 4 bits are zero and you want to convert to 16 bits, you could multiply by 16.
snibgo's IM pages: im.snibgo.com
Re: convert specify the valid range of pixel values
I want to perform contrast stretch.but the output after stretch is becoming 16-bit...I want the output to be 12bt as well
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: convert specify the valid range of pixel values
Have you tried multiplying by 16 before the contrast-stretch, then dividing by 16?
snibgo's IM pages: im.snibgo.com
Re: convert specify the valid range of pixel values
snibgo,
I am using the command "convert" .
How can be specify x16 and /16 in the command ?
I am using the command "convert" .
How can be specify x16 and /16 in the command ?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: convert specify the valid range of pixel values
Code: Select all
convert in.ext -evaluate Multiply 16 -contrast-stretch {whatever} -evaluate Divide 16 out.ext
I don't know if "LeftShift 4" might be faster or better.
snibgo's IM pages: im.snibgo.com
Re: convert specify the valid range of pixel values
Thanks snibgo. What you said worked!