Version: 1.4.88 (using KDE 3.4.91 (beta1, >= 20050910), compiled sources) Compiler: gcc version 3.3.5 (Debian 1:3.3.5-13) OS: Linux (i686) release 2.6.11.1 If you get a JPEG from a digital camera the changes it contains the 'orientation' field is pretty high. It would be great if the rotate feature in krita would adjust the orientation flag if present in the meta data. See: http://sylvana.net/jpegcrop/exif_orientation.html
Yes, we should support exif metadata a lot better: I don't think we support it at all except that we try not to throw it away. It's a new feature, though, and I'm not sure how soon it can be implemented. I could probably try to borrow code from digikam here.
SVN commit 500932 by berger: - check for the ORIENTATION exif tag (will work when rotation and mirror are fixed) BUG:112727 M +2 -2 Makefile.am M +57 -0 kis_jpeg_converter.cc --- trunk/koffice/filters/krita/jpeg/Makefile.am #500931:500932 @@ -7,12 +7,12 @@ libkritajpegexport_la_LDFLAGS = -avoid-version -module -no-undefined \ $(KDE_PLUGIN) $(KDE_RPATH) $(all_libraries) libkritajpegexport_la_LIBADD = $(top_builddir)/krita/libkritacommon.la \ - libkritaconverter.la $(KOFFICE_LIBS) -ljpeg + libkritaconverter.la $(KOFFICE_LIBS) -ljpeg -lexif libkritajpegimport_la_LDFLAGS = -avoid-version -module -no-undefined \ $(KDE_PLUGIN) $(KDE_RPATH) $(all_libraries) libkritajpegimport_la_LIBADD = $(top_builddir)/krita/libkritacommon.la \ - libkritaconverter.la $(KOFFICE_LIBS) -ljpeg + libkritaconverter.la $(KOFFICE_LIBS) -ljpeg -lexif INCLUDES= \ -I$(srcdir) \ --- trunk/koffice/filters/krita/jpeg/kis_jpeg_converter.cc #500931:500932 @@ -40,6 +40,8 @@ #include <kis_meta_registry.h> #include <kis_profile.h> +#include <libexif/exif-loader.h> + #define ICC_MARKER (JPEG_APP0 + 2) /* JPEG marker code for ICC */ #define ICC_OVERHEAD_LEN 14 /* size of non-profile data in APP2 */ #define MAX_BYTES_IN_MARKER 65533 /* maximum data len of a JPEG marker */ @@ -219,9 +221,64 @@ jpeg_destroy_decompress(&cinfo); fclose(fp); + // Read exif information + ExifLoader *l = exif_loader_new (); + + exif_loader_write_file (l,uri.path().ascii()); + + ExifData *ed = exif_loader_get_data (l); + + ed = exif_loader_get_data (l); + exif_loader_unref (l); + if (ed) { // there are some exif tags + ExifTag tag = EXIF_TAG_ORIENTATION; + ExifIfd ifd = EXIF_IFD_0; + ExifEntry *e = exif_content_get_entry ( ed->ifd[ifd], tag); + if(e) + { + char buf[1024]; + char value[1024]; +// exif_entry_get_value (e, value, sizeof(value)); + ExifShort v_short = exif_get_short (e->data, exif_data_get_byte_order (e->parent->parent)); +// kdDebug() << "tag orientation = " << value << " begin " << v_short << " end" << endl; + switch(v_short) // + { + case 2: + layer->paintDevice()->mirrorY(); + break; + case 3: + image()->rotate(180, 0); + break; + case 4: + layer->paintDevice()->mirrorX(); + break; + case 5: + image()->rotate(90, 0); + layer->paintDevice()->mirrorY(); + break; + case 6: + image()->rotate(90, 0); + break; + case 7: + image()->rotate(90, 0); + layer->paintDevice()->mirrorX(); + break; + case 8: + image()->rotate(270, 0); + break; + default: + break; + } + } + } else { + kdDebug() << "no exif information" << endl; + } + return KisImageBuilder_RESULT_OK; } + + KisImageBuilder_Result KisJPEGConverter::buildImage(const KURL& uri) { if (uri.isEmpty())
as exif isn't loaded anymore that bug is back.
SVN commit 688358 by berger: restore metadata framework (under the strict condition stated on krita's mailing list) meaning krita can again load exif and iptc tags BUG: 112727 CCBUG: 138923 M +8 -4 filters/krita/CMakeLists.txt M +4 -2 filters/krita/jpeg/CMakeLists.txt M +176 -1 filters/krita/jpeg/kis_jpeg_converter.cc M +1 -1 filters/krita/jpeg/kis_jpeg_converter.h M +49 -1 filters/krita/jpeg/kis_jpeg_export.cc A filters/krita/libkisexiv2 (directory) filters/krita/libkisexiv2#685376 A filters/krita/libkisexiv2/CMakeLists.txt filters/krita/libkisexiv2/CMakeLists.txt#685376 A filters/krita/libkisexiv2/kis_exif_io.cpp filters/krita/libkisexiv2/kis_exif_io.cpp#685376 [License: LGPL (v2+)] A filters/krita/libkisexiv2/kis_exif_io.h filters/krita/libkisexiv2/kis_exif_io.h#685376 [License: LGPL (v2+)] A filters/krita/libkisexiv2/kis_exiv2.cpp filters/krita/libkisexiv2/kis_exiv2.cpp#685376 [License: LGPL (v2+)] A filters/krita/libkisexiv2/kis_exiv2.h filters/krita/libkisexiv2/kis_exiv2.h#685376 [License: LGPL (v2+)] A filters/krita/libkisexiv2/kis_iptc_io.cpp filters/krita/libkisexiv2/kis_iptc_io.cpp#685376 [License: LGPL (v2+)] A filters/krita/libkisexiv2/kis_iptc_io.h filters/krita/libkisexiv2/kis_iptc_io.h#685376 [License: LGPL (v2+)] M +5 -1 krita/image/CMakeLists.txt M +12 -0 krita/image/kis_layer.cc M +8 -0 krita/image/kis_layer.h A krita/image/metadata (directory) krita/image/metadata#685376 A krita/image/metadata/kis_legacy_importer.cc krita/image/metadata/kis_legacy_importer.cc#685376 [License: LGPL (v2+)] A krita/image/metadata/kis_legacy_importer.h krita/image/metadata/kis_legacy_importer.h#685376 [License: LGPL (v2+)] A krita/image/metadata/kis_meta_data_entry.cc krita/image/metadata/kis_meta_data_entry.cc#685376 [License: LGPL (v2+)] A krita/image/metadata/kis_meta_data_entry.h krita/image/metadata/kis_meta_data_entry.h#685376 [License: LGPL (v2+)] A krita/image/metadata/kis_meta_data_io_backend.cc krita/image/metadata/kis_meta_data_io_backend.cc#685376 [License: LGPL (v2+)] A krita/image/metadata/kis_meta_data_io_backend.h krita/image/metadata/kis_meta_data_io_backend.h#685376 [License: LGPL (v2+)] A krita/image/metadata/kis_meta_data_schema.cc krita/image/metadata/kis_meta_data_schema.cc#685376 [License: LGPL (v2+)] A krita/image/metadata/kis_meta_data_schema.h krita/image/metadata/kis_meta_data_schema.h#685376 [License: LGPL (v2+)] A krita/image/metadata/kis_meta_data_store.cc krita/image/metadata/kis_meta_data_store.cc#685376 [License: LGPL (v2+)] A krita/image/metadata/kis_meta_data_store.h krita/image/metadata/kis_meta_data_store.h#685376 [License: LGPL (v2+)] A krita/image/metadata/kis_meta_data_value.cc krita/image/metadata/kis_meta_data_value.cc#685376 [License: LGPL (v2+)] A krita/image/metadata/kis_meta_data_value.h krita/image/metadata/kis_meta_data_value.h#685376 [License: LGPL (v2+)] M +0 -1 krita/plugins/paintops/CMakeLists.txt M +1 -1 krita/plugins/paintops/dynamicbrush/lib/sensors/kis_dynamic_sensor_time.cc M +2 -1 krita/plugins/viewplugins/CMakeLists.txt M +0 -4 krita/plugins/viewplugins/bracketing2hdr/bracketing2hdr.cc A krita/plugins/viewplugins/metadataeditor (directory) krita/plugins/viewplugins/metadataeditor#685376 A krita/plugins/viewplugins/metadataeditor/CMakeLists.txt krita/plugins/viewplugins/metadataeditor/CMakeLists.txt#685376 A krita/plugins/viewplugins/metadataeditor/editors (directory) krita/plugins/viewplugins/metadataeditor/editors#685376 A krita/plugins/viewplugins/metadataeditor/editors/dublincore.rc krita/plugins/viewplugins/metadataeditor/editors/dublincore.rc#685376 A krita/plugins/viewplugins/metadataeditor/editors/dublincore.ui krita/plugins/viewplugins/metadataeditor/editors/dublincore.ui#685376 A krita/plugins/viewplugins/metadataeditor/editors/exif.rc krita/plugins/viewplugins/metadataeditor/editors/exif.rc#685376 A krita/plugins/viewplugins/metadataeditor/editors/exif.ui krita/plugins/viewplugins/metadataeditor/editors/exif.ui#685376 A krita/plugins/viewplugins/metadataeditor/kis_entry_editor.cc krita/plugins/viewplugins/metadataeditor/kis_entry_editor.cc#685376 [License: LGPL (v2+)] A krita/plugins/viewplugins/metadataeditor/kis_entry_editor.h krita/plugins/viewplugins/metadataeditor/kis_entry_editor.h#685376 [License: LGPL (v2+)] A krita/plugins/viewplugins/metadataeditor/kis_meta_data_editor.cc krita/plugins/viewplugins/metadataeditor/kis_meta_data_editor.cc#685376 [License: LGPL (v2+)] A krita/plugins/viewplugins/metadataeditor/kis_meta_data_editor.h krita/plugins/viewplugins/metadataeditor/kis_meta_data_editor.h#685376 [License: LGPL (v2+)] A krita/plugins/viewplugins/metadataeditor/kritametadataeditor.desktop krita/plugins/viewplugins/metadataeditor/kritametadataeditor.desktop#685376 A krita/plugins/viewplugins/metadataeditor/metadataeditor.cc krita/plugins/viewplugins/metadataeditor/metadataeditor.cc#685376 [License: LGPL (v2+)] A krita/plugins/viewplugins/metadataeditor/metadataeditor.h krita/plugins/viewplugins/metadataeditor/metadataeditor.h#685376 [License: LGPL (v2+)] A krita/plugins/viewplugins/metadataeditor/metadataeditor.rc krita/plugins/viewplugins/metadataeditor/metadataeditor.rc#685376