summaryrefslogtreecommitdiffstats
path: root/src/extension/internal/image-resolution.cpp
diff options
context:
space:
mode:
authorNicolas Dufour <nicoduf@yahoo.fr>2013-10-22 07:58:06 +0000
committerJazzyNico <nicoduf@yahoo.fr>2013-10-22 07:58:06 +0000
commit85d006da1275720a89d55688f74b5a152b42f701 (patch)
tree6d8114f16aed73f2d40825b6b29bbf1e1e31381c /src/extension/internal/image-resolution.cpp
parentFix for Bug #1230292 (dbus service file not included in tarball when doing a ... (diff)
downloadinkscape-85d006da1275720a89d55688f74b5a152b42f701.tar.gz
inkscape-85d006da1275720a89d55688f74b5a152b42f701.zip
Fixing unit convertion in PNG import Imagemagick fallback (see Bug #165952).
(bzr r12711)
Diffstat (limited to 'src/extension/internal/image-resolution.cpp')
-rw-r--r--src/extension/internal/image-resolution.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/extension/internal/image-resolution.cpp b/src/extension/internal/image-resolution.cpp
index b38b0ddc7..865e86698 100644
--- a/src/extension/internal/image-resolution.cpp
+++ b/src/extension/internal/image-resolution.cpp
@@ -342,9 +342,16 @@ void ImageResolution::readmagick(char const *fn) {
image.read(fn);
} catch (...) {}
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();
+ }
- x_ = Inkscape::Util::Quantity::convert((double)geo.width(), "pt", "px");
- y_ = Inkscape::Util::Quantity::convert((double)geo.height(), "pt", "px");
ok_ = true;
}