librelist archives

« back to archive

Reading 16-bit images with pgmagick?

Reading 16-bit images with pgmagick?

John Pye
2012-02-10 @ 22:08
Hi there

I have installed a copy of pgmagick 0.3.6 on my Ubuntu 11.10 machine. 
It's the standard version that they've packaged in their software 

I then tried loading a RAW image, using

from pgmagick import *
i = Image("DSC_0004.DSC")

but the output that I get is "8", when I expected to see 12-bit data (or 
16, if it wants to pad it out).

If, on the other hand, I take the same raw image and use dcraw to 
convert it to TIFF using

dcraw -T -4 DSC_0004.NEF

and then read the file using

from tifffile import *
t = TIFFfile("DSC_0004.tiff")

shows me (16,16,16), which I presume means 16 bits for each of R, G, B.

Is there any way I can get pgmagick, and all its image manipulation 
functions, to work properly with 16-bit images (well, 12-bit, as I said) 
like this one?

Perhaps I just need to use a new version of gm or pgmagick?

Or could it be that graphicsmagick is not passing the correct flags to 
'dcraw', which it runs externally? No, that's not the problem, because 
if I use pgmagick to load the TIFF file created earlier, I still get 
8-bits being reported back to me.