Cannot read GeoTIFF files using Magick++ API

149 Views Asked by At

Using Magick++ C++ API for ImageMagick library, I am trying to convert a GeoTIFF file to JPG File, as such:

Magick::Image input;
try {
   input.read("inputfile.tif");
   input.write("outputfile.jpg");
} 
catch (Exception &error) {
   cout << error.what() << '\n';
}

The program prints this message and fails to create outputfile.jpg:

Magick: Unknown field with tag 33550 (0x830e) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/960

Other conversions (.jpg to normal .tiff, .jpg to .pdf, normal .tiff to .jpg, ...) work fine

Interestingly, bypassing the API and calling the ImageMagick convert command directly works (albeit still giving me the above warning):

system("convert inputfile.tif outputfile.jpg");

But I do not want the installed library to be a requirement when excecuting the program. Is there a better way to do this? Could the different headers in the GeoTIFF format be the problem? Shouldn't any program that can read TIFF files also be able to read GeoTIFF files?

Should I forget about ImageMagick library and use something like GDAL instead?

Regards,

0

There are 0 best solutions below