diff options
Diffstat (limited to 'src/extension/internal/image-resolution.cpp')
| -rw-r--r-- | src/extension/internal/image-resolution.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/extension/internal/image-resolution.cpp b/src/extension/internal/image-resolution.cpp index 18eb97f80..e96fd6437 100644 --- a/src/extension/internal/image-resolution.cpp +++ b/src/extension/internal/image-resolution.cpp @@ -353,18 +353,20 @@ void ImageResolution::readmagick(char const *fn) { g_warning("ImageResolution::readmagick: Unknown error"); return; } - Magick::Geometry geo = image.density(); - std::string type = image.magick(); - - if (type == "PNG") { // PNG only supports pixelspercentimeter - x_ = Inkscape::Util::Quantity::convert((double)geo.width(), "in", "cm"); - y_ = Inkscape::Util::Quantity::convert((double)geo.height(), "in", "cm"); - } else { - x_ = (double)geo.width(); - y_ = (double)geo.height(); - } - ok_ = true; + std::string const type = image.magick(); + x_ = image.xResolution(); + y_ = image.yResolution(); + +// TODO: find out why the hell the following convertion is necessary + if (type == "BMP") { + x_ = Inkscape::Util::Quantity::convert(x_, "in", "cm"); + y_ = Inkscape::Util::Quantity::convert(y_, "in", "cm"); + } + + if (x_ != 0 && y_ != 0) { + ok_ = true; + } } #else |
