Code: Select all
gray16_view_t u16view = ...;
uint16_t* data = interleaved_view_get_raw_data(u16view);
size_t length = sizeof(u16) * u16view.width() * u16view.height();
Magick::Blob u16Blob(data, length);
Magick::Geometry size(u16view.width(), u16view.height());
Magick::Image u16MagickImg(u16Blob, size, 16, "GRAY");
u16MagickImg.write("test-16bit.png");
Some discussion of imagemagick's PNG handling is here: http://www.imagemagick.org/Usage/formats/#png_formats They list PNG8, PNG24, and PNG32 as available formats, but the following section implies that the following on the commandline would have the desired output.
Code: Select all
-define png:bit-depth 16
-define png:color-type=0