Possible bug: Resolution Units
Posted: 2015-05-06T11:13:59-07:00
I am using Magick C++ API, to read and write PNG format files.
I have an image that i save with resolution and resolution unit like this:
Once i read the same image right after, my resolution units are set to unknown (0), why is that? I think that is the bug in magick++.
Read code:
I am saving an image in PNG format. Please let me know if you need more information.
My OS Win 7 64 bit, using ImageMagick source compiled version 6.9.1-2.
Potential proposed fixed is here:
I debugged image magic, and the problem is during the retrieval of resolutionUnits from the image.
After i read the image, i call to return resolution units In Image.cpp this code gets executed
Unfortunately constOptions() are not set, or updated during the read, so it contains default values for all attributes.
This code should be updated to this:
Image attributes contains all the attributes setup after the read, constOptions doesnt.
I have an image that i save with resolution and resolution unit like this:
Code: Select all
someImage.density(Geometry(resolution, resolution));
someImage.resolutionUnits(MagickCore::ResolutionType::PixelsPerCentimeterResolution);
someImage.write(imagePath);
Read code:
Code: Select all
Image someImage2;
someImage2.read(imagePath);
int resUnit2 = someImage2.resolutionUnits();
My OS Win 7 64 bit, using ImageMagick source compiled version 6.9.1-2.
Potential proposed fixed is here:
I debugged image magic, and the problem is during the retrieval of resolutionUnits from the image.
After i read the image, i call to return resolution units In Image.cpp this code gets executed
Code: Select all
Magick::ResolutionType Magick::Image::resolutionUnits(void) const
{
return(constOptions()->resolutionUnits());
}
This code should be updated to this:
Code: Select all
Magick::ResolutionType Magick::Image::resolutionUnits(void) const
{
return(constImage()->units());
}