From 2b1a0283357fec95109b67f9379ebec4bf56338e Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Thu, 10 Apr 2014 07:43:01 +0200 Subject: Fix for Bug #1302987 (Importing a PNG image with unittype field undefined fails). Fixed bugs: - https://launchpad.net/bugs/1302987 (bzr r13279) --- src/extension/internal/image-resolution.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'src/extension/internal/image-resolution.cpp') 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 -- cgit v1.2.3 From d4d9e436812558588342180c336deb74473cd6c0 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Wed, 1 Oct 2014 09:24:30 +0200 Subject: Importing. Fix for Bug #1325822 (BMP images resolution not correctly imported). Fixed bugs: - https://launchpad.net/bugs/1325822 (bzr r13573) --- src/extension/internal/image-resolution.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/extension/internal/image-resolution.cpp') diff --git a/src/extension/internal/image-resolution.cpp b/src/extension/internal/image-resolution.cpp index f092b21ef..e96fd6437 100644 --- a/src/extension/internal/image-resolution.cpp +++ b/src/extension/internal/image-resolution.cpp @@ -354,8 +354,15 @@ void ImageResolution::readmagick(char const *fn) { return; } + 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; -- cgit v1.2.3