convert 16-bit tiff to 8-bit tiff

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
langstrump

convert 16-bit tiff to 8-bit tiff

Post by langstrump »

Hej allihop!
I want to convert a 16-bit tiff image to 8-bit:
this is the information I get about the original image with identify:
original.tiff TIFF 658x486 658x486+0+0 16-bit Grayscale DirectClass 640KB 0.000u 0:00.000

I tried the following command:
convert original.tiff -depth 8 -define quantum:format=unsigned -type grayscale test.tiff

This does not seem to work as the resulting tiff is just black.
I have no clue what could be wrong and be happy about any help!

langstrump
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: convert 16-bit tiff to 8-bit tiff

Post by fmw42 »

post a link to your input image and report what version of IM you are using. what happens if you remove the -define?

What are the range of values in your tiff? If very low, then you may need to scale the result. try adding -auto-level to your command line before -depth 8
langstrump

Re: convert 16-bit tiff to 8-bit tiff

Post by langstrump »

Thanks a lot! I am not familiar with these image manipulation. The -auto-level option actually solved my problem.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: convert 16-bit tiff to 8-bit tiff

Post by fmw42 »

langstrump wrote:Thanks a lot! I am not familiar with these image manipulation. The -auto-level option actually solved my problem.
That is because your graylevels did not span the full 16-bit range and in fact were probably very low. When converted to 8-bits they may have been made relatively lower. The auto-level caused the input values to stretch to span the full 16-bit dynamic range so that when converted to 8-bits they still spanned the full dynamic range.
Post Reply