Problem with reading raw 16bit RGB data
Manuel Koch <[email protected]>
| Newsgroups | gmane.comp.video.graphicsmagick.help |
|---|---|
| Message-ID | <[email protected]> |
Hello
I try to extract 16bit image from RAW camera image [1] using libraw.
The output of libraw is described as 16bit plain bitmap of RGB values.
See http://www.libraw.org/docs/API-CXX-eng.html#dcraw_make_mem_image.
Somehow I’m unable to create an Magick::Image() instance of this extracted 16bit RGB bitmap data using the following code :
// „image“ is a structure returned from libraw containing the data of the extracted image
Magick::Blob blob( image->data, image->data_size ); // „data_size“ is 61011696
Magick::Image img;
img.size( Magick::Geometry(image->width,image->height) ); // „width“ is 3908, „height“ is 2602
img.depth( image->bits ); // „bits“ is 16
img.magick( "RGB" );
img.read( blob );
After read() the call to isValid() returns true.
Saving this image to a file succeeds, but results in unrecognizable image waste !?
img.magick("TIF");
img.write(„test.tif“);
I saved the intermediate image data of libraw to a file „test.rgb“ [2] and tried the following
$ gm identify -size 3908x2602 test.rgb
test.rgb RGB 3908x2602+0+0 DirectClass 16-bit 58.2Mi 0.000u 0:01
Using the libraw function LibRaw::dcraw_ppm_tiff_writer() from the same extracted image data does result in a proper tif image [3].
Thus I assume that the general functionality of extracting the image from the camera RAW image works.
Any hint appreciated to help me finding out what I did wrong using GraphicsMagick.
[1] Camera RAW image: https://www.dropbox.com/s/c6j5udiupkq5otm/01.cr2?dl=0
[2] Saved 16bit RGB bitmap: https://www.dropbox.com/s/p5ijmy5k4sje0nw/01.rgb?dl=0
[3] Thumbnail of image saved with libraw: https://www.dropbox.com/s/42vy8knt56obxl2/01.cr2.jpg?dl=0
------------------------------------------------------------------------------
Presto, an open source distributed SQL query engine for big data, initially
developed by Facebook, enables you to easily query your data on Hadoop in a
more interactive manner. Teradata is also now providing full enterprise
support for Presto. Download a free open source copy now.
http://pubads.g.doubleclick.net/gampad/clk?id=250295911&iu=/4140
_______________________________________________
Graphicsmagick-help mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/graphicsmagick-help