Problem reading a TIFF file
Posted: 2016-06-29T16:14:02-07:00
I am using the following code to read a TIFF file, resample it at 300 dpi, and save it as an 8-bit deep PNG.
I have managed to get this working via command line arguments (I used mogrify not convert).
The code below throws an exception during the read(). The exception is:
Thumbnail Generation failed: XiThumbnail.exe: unable to open image '(÷.c»': Invalid argument @ error/blob.c/OpenBlob/2695
Any suggestions gratefully received.
Thanks,
Peter Young
I have managed to get this working via command line arguments (I used mogrify not convert).
The code below throws an exception during the read(). The exception is:
Thumbnail Generation failed: XiThumbnail.exe: unable to open image '(÷.c»': Invalid argument @ error/blob.c/OpenBlob/2695
Code: Select all
std::string SrcPath = "T:\Catfish\trunk\catfish\Tools\XiThumbnail\x64\Debug\a(C).TIF";
TheImage.read(SrcPath); // Load the image.
TheImage.magick(ThumbnailFormat.GetBuffer(0)); // Set the destination format.
Magick::Point Sample((double)nThumbnailResolutionDPI, (double)nThumbnailResolutionDPI);
TheImage.resample(Sample); // Resample to the required resolution.
TheImage.depth(8); // Make it an 8-bit thumbnail.
CString DestPath = _T("");
if(TargetFolder.IsEmpty())
TargetFolder = RemoveExtension(SrcFile) + _T(".") + ThumbnailFormat;
else
JoinPath(TargetFolder, RemoveExtension(GetLeafname(SrcFile))) + _T(".") + ThumbnailFormat;
dst = TargetFolder.GetBuffer(0);
TheImage.write(dst); // Save it to disk in the target location.
Thanks,
Peter Young