Summary: | raw display too dark and not rotated | ||
---|---|---|---|
Product: | [Applications] digikam | Reporter: | Daniel Bauer <linux> |
Component: | Plugin-RawImport-Native | Assignee: | Digikam Developers <digikam-bugs-null> |
Status: | RESOLVED WORKSFORME | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | openSUSE | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | 0.9.0 | |
Sentry Crash Report: | |||
Attachments: |
dark unrotated sample from 0.9.0_svn
album preview (correct brightness but unrotated) in 0.9.0 svn same photo in 0.8.1 editor(correct brightness + rotated) |
Description
Daniel Bauer
2006-05-18 13:50:13 UTC
Created attachment 16154 [details]
dark unrotated sample from 0.9.0_svn
Created attachment 16155 [details]
album preview (correct brightness but unrotated) in 0.9.0 svn
Created attachment 16156 [details]
same photo in 0.8.1 editor(correct brightness + rotated)
I've the same problem with MRW files from Dynax5D. Daniel, this is not a bug. 0.9.0 is completly different than 0.8.x release about RAW files support : ==> 0.8.x support only RAW image in 8bits per color per pixel ==> 0.9.0 support RAW file in 16 bits !!! with 0.8.x, dcraw extract image data to compensate automaticly exposure. it's simple and enough with 8 bits images. with 0.9.0, dcraw extract image data in linear mode to unlost image color data depth. To have the right exposure, you need to use ICC color profile management !!! With my Minolta Dynax5D, i use icc color profiles provides with my camera (*.icc). I set the right icc color profile in ICC setup, and that all ! A screenshot : http://digikam3rdparty.free.fr/Screenshots/iccworkflowwithrawimages.png I have started since sometime an icc color profile repository with Paco (another digiKAm developper who have works into icc management). Take a look here : http://digikam3rdparty.free.fr/ICCPROFILES/ ALL contributions welcome about this repository ! If you have anothers icc file to place in this area, let's me hear ! Gilles Caulier These files should be part of the digikam package IMHO. impossible ! These file are copyrighted ! The only solution is to make a web space repository to download outside digikam. I have seen that krita include some icc profiles (available in svn!!!). It's very _DANGEROUS_ with the law ! ICC profiles files aren't free software. Take a care !!! Gilles Caulier Distributing them in a tarball is forbidden, but making them freely available on a website is not ? Sounds a bit odd to me. Distributing a tarball cannot be done by digikam team. It's the responsability of packager (linux dist) to do it. Gilles SVN commit 542179 by cgilles: digikam from trunk : do not perform auto-rotation with RAW files in editor (dcraw will perform this job automaticly), but only auto-rotate JPEG files. TODO: check if TIFF/EP files can be procressed likeJPEG here. CCBUGS: 127577 CCMAIL: digikam-devel@kde.org M +3 -1 dimginterface.cpp --- trunk/extragear/graphics/digikam/utilities/imageeditor/canvas/dimginterface.cpp #542178:542179 @@ -390,7 +390,9 @@ valRet = false; } - if (d->exifOrient) + // Raw file are already rotated properlly by dcraw. Only rotate JPEG file. + // TODO support TIFF/EP file here like JPEG. + if (d->exifOrient && d->image.attribute("format").toString() == QString("JPEG")) exifRotate(d->filename); emit signalImageLoaded(d->filename, valRet); Distributing MP3s as a tar ball is forbidden, but putting them on a webserver is allowed?? Anyway, Digikam should at least provide a standard profile (that one that dcraw uses for it's 8bit mode) which gives usable results. Additional profiles could be made available by get-hot-new-stuff. http://dot.kde.org/1110652641/ SVN commit 542230 by cgilles: digikam from trunk : thumb kio slave : only perform Exif based auto-rotation on JPEG files, not RAW. CCBUGS: 127577 M +78 -68 digikamthumbnail.cpp --- trunk/extragear/graphics/digikam/kioslave/digikamthumbnail.cpp #542229:542230 @@ -21,6 +21,7 @@ * ============================================================ */ #define XMD_H +#define PNG_BYTES_TO_CHECK 4 // C++ includes. @@ -58,6 +59,7 @@ #include <kprocess.h> #include <kio/global.h> #include <kio/thumbcreator.h> +#include <kfilemetainfo.h> // Local includes @@ -84,71 +86,81 @@ using namespace KIO; using namespace Digikam; -static void exifRotate(const QString& filePath, QImage& thumb) +// TODO : check if it's necessary to have a static method here! +void exifRotate(const QString& filePath, QImage& thumb) { - // Rotate thumbnail based on EXIF rotate tag + // Check if the file is an JPEG image + KFileMetaInfo metaInfo(filePath, "image/jpeg", KFileMetaInfo::Fastest); - QWMatrix matrix; - DMetadata metadata(filePath); - DMetadata::ImageOrientation orientation = metadata.getImageOrientation(); - - bool doXform = (orientation != DMetadata::ORIENTATION_NORMAL && - orientation != DMetadata::ORIENTATION_UNSPECIFIED); - - switch (orientation) + if (metaInfo.isValid()) { - case DMetadata::ORIENTATION_NORMAL: - case DMetadata::ORIENTATION_UNSPECIFIED: - break; - - case DMetadata::ORIENTATION_HFLIP: - matrix.scale(-1,1); - break; - - case DMetadata::ORIENTATION_ROT_180: - matrix.rotate(180); - 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: - 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; + if (metaInfo.mimeType() == "image/jpeg" && + metaInfo.containsGroup("Jpeg EXIF Data")) + { + // Rotate thumbnail from JPEG files based on EXIF rotate tag + + QWMatrix matrix; + DMetadata metadata(filePath); + DMetadata::ImageOrientation orientation = metadata.getImageOrientation(); + + bool doXform = (orientation != DMetadata::ORIENTATION_NORMAL && + orientation != DMetadata::ORIENTATION_UNSPECIFIED); + + switch (orientation) + { + case DMetadata::ORIENTATION_NORMAL: + case DMetadata::ORIENTATION_UNSPECIFIED: + break; + + case DMetadata::ORIENTATION_HFLIP: + matrix.scale(-1,1); + break; + + case DMetadata::ORIENTATION_ROT_180: + matrix.rotate(180); + 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: + 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 ); + } } - - //transform accordingly - if ( doXform ) - thumb = thumb.xForm( matrix ); } -#define PNG_BYTES_TO_CHECK 4 - +// TODO : check if it's necessary to have a static method here! static QImage loadPNG(const QString& path) { - png_uint_32 w32, h32; - int w, h; - bool has_alpha; - bool has_grey; - FILE *f; - png_structp png_ptr = NULL; - png_infop info_ptr = NULL; - int bit_depth, color_type, interlace_type; + png_uint_32 w32, h32; + int w, h; + bool has_alpha; + bool has_grey; + FILE *f; + png_structp png_ptr = NULL; + png_infop info_ptr = NULL; + int bit_depth, color_type, interlace_type; has_alpha = 0; has_grey = 0; @@ -159,7 +171,7 @@ if (!f) return qimage; - unsigned char buf[PNG_BYTES_TO_CHECK]; + unsigned char buf[PNG_BYTES_TO_CHECK]; fread(buf, 1, PNG_BYTES_TO_CHECK, f); if (!png_check_sig(buf, PNG_BYTES_TO_CHECK)) @@ -217,8 +229,8 @@ if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY) has_grey = 1; - unsigned char **lines; - int i; + unsigned char **lines; + int i; if (has_alpha) png_set_expand(png_ptr); @@ -451,8 +463,7 @@ return false; } -///////////////////////////////////////////////////////////////////////////////////////// -// JPEG Extraction +// -- JPEG Extraction --------------------------------------------------------------------- struct myjpeg_error_mgr : public jpeg_error_mgr { @@ -604,8 +615,7 @@ return true; } -///////////////////////////////////////////////////////////////////////////////////////// -// Load using DImg +// -- Load using DImg --------------------------------------------------------------------- bool kio_digikamthumbnailProtocol::loadDImg(QImage& image, const QString& path) { @@ -635,8 +645,7 @@ return true; } -///////////////////////////////////////////////////////////////////////////////////////// -// Load using Dcraw +// -- Load using Dcraw --------------------------------------------------------------------- bool kio_digikamthumbnailProtocol::loadDCRAW(QImage& image, const QString& path) { @@ -709,6 +718,8 @@ return true; } +// -- Load using KDE API --------------------------------------------------------------------- + bool kio_digikamthumbnailProtocol::loadKDEThumbCreator(QImage& image, const QString& path) { // this sucks royally. some of the thumbcreators need an instance of @@ -791,8 +802,7 @@ KStandardDirs::makeDir(bigThumbPath_, 0700); } -///////////////////////////////////////////////////////////////////////////////////////// -// KIO slave registration +// -- KIO slave registration --------------------------------------------------------------------- extern "C" { Exif auto-rotation is fixed in 0.9.0 like 0.8.x does. The problem with RAW thumb is that dcraw extract the embeded thumb from pictures as well with apply some rotation. There is no yet a solution to do it, perhaps in the future when Exiv2 will support RAW thumbnails extraction like it does with JPEG files. Gilles I have an impression that krita icc profiles *are* free but not top quality. I agree to include some standard and free to use ICC profiles files in digikam dist. but we need to take a care about (c) and others stuff. All suggestions welcome. Gilles Please follow these interesting threads on openicc http://lists.freedesktop.org/archives/openicc/2005q2/000379.html http://lists.freedesktop.org/archives/openicc/2005q4/000668.html Bye Thorsten I have a similiar problem with the rotation of raw files within the album (0.9.0-svn). My NEF files doesn't include the exif information in the jpeg-thumbnails. examples: http://slave.paranoidbsd.org/photo/dsc-0002.nef and extracted thumbnail: http://slave.paranoidbsd.org/photo/dsc-0002.dcraw-e.jpg Or should I fill a differnt bug report? |