Converting 16bit raw data to Tiff results in black image (but with the data still in there, just squished?)

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
HoloPed
Posts: 1
Joined: 2015-07-30T11:31:18-07:00
Authentication code: 1151

Converting 16bit raw data to Tiff results in black image (but with the data still in there, just squished?)

Post by HoloPed »

Hey all,
I have raw bytes in a binary file. Each pixels is two bytes.
I'm using this command to convert it into TIFF:

Code: Select all

 convert.exe  -size 1200x1024 -depth 16 -endian LSB gray:rawFile -compress lzw tiffName.tif 
The resulting image is black, but if I open it in Photoshop and do auto-levels, it's all there.
What am I missing ?
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Converting 16bit raw data to Tiff results in black image (but with the data still in there, just squished?)

Post by dlemstra »

Can you add a link to your rawFile? And what is your IM version and platform?
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Converting 16bit raw data to Tiff results in black image (but with the data still in there, just squished?)

Post by fmw42 »

Do the same as in PS. Use -auto-level.

Code: Select all

convert.exe  -size 1200x1024 -depth 16 -endian LSB gray:rawFile -compress lzw -auto-level tiffName.tif
Your tiff may have for example 10 bit range of data but in a 16-bit image format. So you could multiply by the appropriate amount as well using -evaluate multiply X


What do you get from running

identify -verbose tiffName.tif

after running your command line without the -auto-level
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Converting 16bit raw data to Tiff results in black image (but with the data still in there, just squished?)

Post by snibgo »

Looking at the minimum. maximum and mean values should provide some insight.

Another possibility, in addition to the above comments, is that data is linear RGB rather than non-linear sRGB.

To test for this, after "-auto-level", insert "-set colorspace RGB -colorspace sRGB". This will lighten mid-tones. If the result looks better, then keep this change. If it looks worse, remove it.
snibgo's IM pages: im.snibgo.com
Post Reply