Index: imageutils/jpegcontent.cpp =================================================================== --- imageutils/jpegcontent.cpp (revisione 787661) +++ imageutils/jpegcontent.cpp (copia locale) @@ -330,11 +330,16 @@ // 3 = centimeters // Other = reserved const float INCHESPERMETER = (100. / 2.54); + Exiv2::Rational r = it->toRational(); + if (r.second == 0) { + // a rational with 0 as second will make hang toLong() conversion + r.second = 1; + } switch (res) { case 3: // dots per cm - return (it->toLong() * 100); + return int(float(r.first) * 100 / float(r.second)); default: // dots per inch - return (it->toLong() * INCHESPERMETER); + return int(float(r.first) * INCHESPERMETER / float(r.second)); } return 0;