read() does not maintain depth
Posted: 2013-04-15T10:05:40-07:00
Obviously I am relatively new to Magick++. I read in a 16-bit TIF file, but its depth prints as 8, and the resultant JPEG2000 file is also only 8 bpp. Can you tell me what I'm doing wrong? Thank you.
Version: ImageMagick 6.6.9-7 2012-08-17 Q16
Version: ImageMagick 6.6.9-7 2012-08-17 Q16
Code: Select all
$ identify fullres.tif
fullres.tif TIFF 2560x3328 2560x3328+0+0 16-bit Grayscale DirectClass 5.893MB 0.000u 0:00.000
Code: Select all
#include <iostream>
#include <Magick++.h>
int main(int argc, char **argv)
{
Magick::InitializeMagick(*argv);
Magick::Image
image;
try
{
image.read("fullres.tif");
std::cout << "Depth: " << image.depth() << std::endl;
image.write("test.jp2");
}
catch(Magick::Exception &ex)
{
std::cerr << "Exception: " << ex.what() << std::endl;
}
return 0;
}
Code: Select all
$ identify test.jp2
test.jp2 JP2 2560x3328 2560x3328+0+0 8-bit DirectClass 519KB 0.380u 0:00.390