Page 1 of 1

How to read a RGB 14 bit per channel image

Posted: 2011-12-15T03:21:27-07:00
by markmarques
Recently I have found the following problem:
I have a scanner that "suposelly" give 14 bits per channel depth but the only "image format"
I get to output / work with that depth is a RAW RGB file with the plain RGB data ...

Problem 1: I do not have always the same width nor height ... :(
I am using the IrfanView program but despite the image being shown if I "quit" I get asked to insert the correct size ( which I do not know ...)

So I am having several raw images that I can not read ... :(

IM convert reports that does does not have a decode delegate ...

If I try the identify util I also get the same "error" ...
how can I bypass the delegate and or force the file to be interpreted by IM ?

Is it possible to call convert with something like "convert -depth 14 image.raw JPG:output.jpg" without specifing sizes ?

Re: How to read a RGB 14 bit per channel image

Posted: 2011-12-15T22:42:15-07:00
by anthony
Without knowing exactly what they mean by 14 bits per pixel it is hard to say. Is it 2 bytes per value (16 bits) containign a 14 bit integer? Or do they mungle the bits together without regard for byte boundaries. Or perhaps 4 channels making it 4*14 or 56 bits and 7 bytes per pixel?

The "stream" utility may be able to to that latter, generating raw 16bit RGBA values taht normal Imagemagick commands can read.

Re: How to read a RGB 14 bit per channel image

Posted: 2011-12-16T07:19:59-07:00
by markmarques
hi, after some more fidling I have found that the RAW image is read correclty with Irfanview ( the original program that made the image ... )
with the following options :
24 BPP ( 3bytes per pixel ) ; Color order: RGB ( 32bit RGBA) ; Interleaved (RGB) ...
But I have to "feed" the correct size first !!!

Nonetheless with the help of another uitl I have found that
by the size of the file 4106907 bytes I get something like 987x1387 ...
AFter finding those values I "feed" them to irfanview and got the correct image ...

How can i read this raw image with IM knowing this kind of info ?

Re: How to read a RGB 14 bit per channel image

Posted: 2011-12-18T17:19:04-07:00
by anthony
Assuming 24 bit oer pixel. 8 bit depth, RGB order and a size of 987x1387...

Code: Select all

  convert  -depth 8 -size 987x1387 rgb:raw_data   image.png
See Raw RGB data
http://www.imagemagick.org/Usage/formats/#rgb

Note when 16bits per color value is use you may also need a -endian setting to determine byte order (LSB is default)
I have made use of these settings for generating raw data output for gnuplot graphing.