extragear/graphics/gwenview
Angelo Naselli <[email protected]>
| Newsgroups | gmane.comp.kde.gwenview |
|---|---|
| Message-ID | <[email protected]> |
SVN commit 646489 by anaselli: Now jpeg with exif info can be managed for printing without scaling as well. Please Aurélien take a look at it. CCBUG:129948 CCMAIL:[email protected] M +2 -0 gvcore/imageloader.cpp M +60 -0 imageutils/jpegcontent.cpp M +3 -0 imageutils/jpegcontent.h --- trunk/extragear/graphics/gwenview/gvcore/imageloader.cpp #646488:646489 @@ -673,6 +673,8 @@ QSize size = content.size(); d->mProcessedImage = QImage(size, d->mDecoder.image().depth()); } + d->mProcessedImage.setDotsPerMeterX(content.getDotsPerMeterX()); + d->mProcessedImage.setDotsPerMeterY(content.getDotsPerMeterY()); } else { kdWarning() << "ImageLoader::changed(): JPEGContent could not load '" << d->mURL.prettyURL() << "'\n"; } --- trunk/extragear/graphics/gwenview/imageutils/jpegcontent.cpp #646488:646489 @@ -290,6 +290,66 @@ } +int JPEGContent::getDotsPerMeterX() const { + Exiv2::ExifKey keyResUnit("Exif.Image.ResolutionUnit"); + Exiv2::ExifData::iterator it = d->mExifData.findKey(keyResUnit); + if (it == d->mExifData.end()) { + return 0; + } + int XRes = it->toLong(); + Exiv2::ExifKey keyXResolution("Exif.Image.XResolution"); + it = d->mExifData.findKey(keyXResolution); + if (it == d->mExifData.end()) { + return 0; + } + // The unit for measuring XResolution and YResolution. The same unit is used for both XResolution and YResolution. + // If the image resolution in unknown, 2 (inches) is designated. + // Default = 2 + // 2 = inches + // 3 = centimeters + // Other = reserved + const float INCHESPERMETER = (100. / 2.54); + switch (XRes) { + case 3: // dots per cm + return (it->toLong() * 100); + default: // dots per inch + return (it->toLong() * INCHESPERMETER); + } + + return 0; +} + + +int JPEGContent::getDotsPerMeterY() const { + Exiv2::ExifKey keyResUnit("Exif.Image.ResolutionUnit"); + Exiv2::ExifData::iterator it = d->mExifData.findKey(keyResUnit); + if (it == d->mExifData.end()) { + return 0; + } + int YRes = it->toLong(); + Exiv2::ExifKey keyYResolution("Exif.Image.YResolution"); + it = d->mExifData.findKey(keyYResolution); + if (it == d->mExifData.end()) { + return 0; + } + // The unit for measuring XResolution and YResolution. The same unit is used for both XResolution and YResolution. + // If the image resolution in unknown, 2 (inches) is designated. + // Default = 2 + // 2 = inches + // 3 = centimeters + // Other = reserved + const float INCHESPERMETER = (100. / 2.54); + switch (YRes) { + case 3: // dots per cm + return (it->toLong() * 100); + default: // dots per inch + return (it->toLong() * INCHESPERMETER); + } + + return 0; +} + + void JPEGContent::resetOrientation() { Exiv2::ExifKey key("Exif.Image.Orientation"); Exiv2::ExifData::iterator it = d->mExifData.findKey(key); --- trunk/extragear/graphics/gwenview/imageutils/jpegcontent.h #646488:646489 @@ -43,6 +43,9 @@ Orientation orientation() const; void resetOrientation(); + + int getDotsPerMeterX() const; + int getDotsPerMeterY() const; QSize size() const; ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Gwenview-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/gwenview-general