summaryrefslogtreecommitdiffstats
path: root/src/extension/internal/image-resolution.cpp
diff options
context:
space:
mode:
authorNicolas Dufour <nicoduf@yahoo.fr>2014-04-10 05:43:01 +0000
committerJazzyNico <nicoduf@yahoo.fr>2014-04-10 05:43:01 +0000
commit2b1a0283357fec95109b67f9379ebec4bf56338e (patch)
tree7f468f3252bbc85a9b69af82576e643c83f08655 /src/extension/internal/image-resolution.cpp
parentExclude files in POTFILES.skip from the POTFILES.in generated (diff)
downloadinkscape-2b1a0283357fec95109b67f9379ebec4bf56338e.tar.gz
inkscape-2b1a0283357fec95109b67f9379ebec4bf56338e.zip
Fix for Bug #1302987 (Importing a PNG image with unittype field undefined fails).
Fixed bugs: - https://launchpad.net/bugs/1302987 (bzr r13279)
Diffstat (limited to 'src/extension/internal/image-resolution.cpp')
-rw-r--r--src/extension/internal/image-resolution.cpp17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/extension/internal/image-resolution.cpp b/src/extension/internal/image-resolution.cpp
index 18eb97f80..f092b21ef 100644
--- a/src/extension/internal/image-resolution.cpp
+++ b/src/extension/internal/image-resolution.cpp
@@ -353,18 +353,13 @@ 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;
+ x_ = image.xResolution();
+ y_ = image.yResolution();
+
+ if (x_ != 0 && y_ != 0) {
+ ok_ = true;
+ }
}
#else