[Digikam-devel] [Bug 131603] Orientation of RAW-images (especially Canons *.cr2)
Gerhard Kulzer
gerhard at kulzer.net
Tue Aug 1 09:02:06 BST 2006
Thanks Marcel,
now the thumbnail orientation of my cr2 files is correct for the first time in
0.9
Gerhard
Am Montag, 31. Juli 2006 23:40 schrieb Marcel Wiesweg:
> ------- You are receiving this mail because: -------
> You are the assignee for the bug, or are watching the assignee.
>
> http://bugs.kde.org/show_bug.cgi?id=131603
>
>
>
>
> ------- Additional Comments From marcel.wiesweg gmx de 2006-07-31 23:40
> ------- SVN commit 568351 by mwiesweg:
>
> Rotate RAW thumbnails as well, not only JPEGs contains rotation
> information.
>
> CCBUGS: 131532, 131603
>
>
> M +38 -47 digikamthumbnail.cpp
>
>
> --- trunk/extragear/graphics/digikam/kioslave/digikamthumbnail.cpp
> #568350:568351 @ -422,65 +422,56 @
>
> void kio_digikamthumbnailProtocol::exifRotate(const QString& filePath,
> QImage& thumb) {
> - // Check if the file is an JPEG image
> - KFileMetaInfo metaInfo(filePath, "image/jpeg",
> KFileMetaInfo::Fastest); + // Rotate thumbnail based on metadata
> orientation information
>
> - if (metaInfo.isValid())
> - {
> - if (metaInfo.mimeType() == "image/jpeg" &&
> - metaInfo.containsGroup("Jpeg EXIF Data"))
> - {
> - // Rotate thumbnail from JPEG files based on EXIF rotate tag
> + DMetadata metadata(filePath);
> + DMetadata::ImageOrientation orientation =
> metadata.getImageOrientation();
>
> - QWMatrix matrix;
> - DMetadata metadata(filePath);
> - DMetadata::ImageOrientation orientation =
> metadata.getImageOrientation(); + if (orientation ==
> DMetadata::ORIENTATION_NORMAL ||
> + orientation == DMetadata::ORIENTATION_UNSPECIFIED)
> + return;
>
> - bool doXform = (orientation != DMetadata::ORIENTATION_NORMAL
> && - orientation !=
> DMetadata::ORIENTATION_UNSPECIFIED); + QWMatrix matrix;
>
> - switch (orientation)
> - {
> - case DMetadata::ORIENTATION_NORMAL:
> - case DMetadata::ORIENTATION_UNSPECIFIED:
> - break;
> + switch (orientation)
> + {
> + case DMetadata::ORIENTATION_NORMAL:
> + case DMetadata::ORIENTATION_UNSPECIFIED:
> + break;
>
> - case DMetadata::ORIENTATION_HFLIP:
> - matrix.scale(-1, 1);
> - break;
> + case DMetadata::ORIENTATION_HFLIP:
> + matrix.scale(-1, 1);
> + break;
>
> - case DMetadata::ORIENTATION_ROT_180:
> - matrix.rotate(180);
> - break;
> + case DMetadata::ORIENTATION_ROT_180:
> + matrix.rotate(180);
> + break;
>
> - case DMetadata::ORIENTATION_VFLIP:
> - matrix.scale(1, -1);
> - break;
> + case DMetadata::ORIENTATION_VFLIP:
> + matrix.scale(1, -1);
> + break;
>
> - case DMetadata::ORIENTATION_ROT_90_HFLIP:
> - matrix.scale(-1, 1);
> - matrix.rotate(90);
> - break;
> + case DMetadata::ORIENTATION_ROT_90_HFLIP:
> + matrix.scale(-1, 1);
> + matrix.rotate(90);
> + break;
>
> - case DMetadata::ORIENTATION_ROT_90:
> - matrix.rotate(90);
> - break;
> + case DMetadata::ORIENTATION_ROT_90:
> + matrix.rotate(90);
> + break;
>
> - case DMetadata::ORIENTATION_ROT_90_VFLIP:
> - matrix.scale(1, -1);
> - matrix.rotate(90);
> - break;
> + case DMetadata::ORIENTATION_ROT_90_VFLIP:
> + matrix.scale(1, -1);
> + matrix.rotate(90);
> + break;
>
> - case DMetadata::ORIENTATION_ROT_270:
> - matrix.rotate(270);
> - break;
> - }
> -
> - //transform accordingly
> - if ( doXform )
> - thumb = thumb.xForm( matrix );
> - }
> + case DMetadata::ORIENTATION_ROT_270:
> + matrix.rotate(270);
> + break;
> }
> +
> + // transform accordingly
> + thumb = thumb.xForm( matrix );
> }
>
> QImage kio_digikamthumbnailProtocol::loadPNG(const QString& path)
> _______________________________________________
> Digikam-devel mailing list
> Digikam-devel at kde.org
> https://mail.kde.org/mailman/listinfo/digikam-devel
--
http://www.gerhard.fr
More information about the Digikam-devel
mailing list