Bug 328321 - Image orientation is not maintained when processing RAW image through BQM
Summary: Image orientation is not maintained when processing RAW image through BQM
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: BatchQueueManager-RAWProcessing (show other bugs)
Version: 5.3.0
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-02 10:45 UTC by Michal Thoma
Modified: 2017-01-13 11:11 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.5.0


Attachments
Exifs tags differences between the original RAW file and the generated JPG coming from batch queue manager / convert into JPG process (5.08 KB, text/plain)
2016-12-15 11:34 UTC, Dav
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michal Thoma 2013-12-02 10:45:22 UTC
When you process RAW images through BQM with internal preview settings, the image orientation is not maintained. It doesn't matter if the orientation was set by the camera or later in digikam, the image is saved as landscape. 

Reproducible: Always

Steps to Reproduce:
1. Put some raw images to BQM
2. Set internal preview for RAW develepoment settings.
3. Process.
Actual Results:  
All images are landscape regardless their setting.

Expected Results:  
Images should be oriented according to the exif and digikam settings.
Comment 1 caulier.gilles 2013-12-02 13:08:22 UTC
This is a weird problem very difficult to solve.

Preview from RAW are embedded JPEG. If you turn image with camera control before to upload files on computer, in case you want to review images on your device at shot time, this process JPEG image, not RAW of course. And in this case, some camera do not patch Exif orientation tag accordingly. Preview orientation is not the same than RAW image. Bref, it's a mess... Thanks camera maker with RAW files...

Gilles Caulier
Comment 2 Michal Thoma 2013-12-02 23:54:54 UTC
I don't know how the BQM actually grabs the preview, but when preview is used to build thumbnails or preview is viewed during album browsing, digikam knows how to handle orientation (at least for most of the RAW images).
Comment 3 caulier.gilles 2013-12-03 07:13:58 UTC
BQM must work as preview and thumbnails processing. It's the same internal component which run.

So, it can be a settings problem here.

Can you share some RAW files (+ XMP sidecar file if you use it) to test. Please use an internet file service, bugzilla is limited with large file hosting.

Gilles Caulier
Comment 4 Michal Thoma 2013-12-03 16:09:52 UTC
Sample PEF file from Pentax K5 with XMP sidecar is here: http://download.thoma.cz/raw-pef-orientation.zip
Comment 5 Michal Thoma 2014-01-24 19:10:10 UTC
Just one additional observation - orientation is not maintained even when demosaicing raw files in case of cameras without orientation sensor (old cameras, images with orientation set manually). In case camera has orientation sensor, the orientation is maintained when processing in BQM.
Comment 6 caulier.gilles 2014-09-01 11:33:24 UTC
Michal,

This file still valid using last digiKam 4.2.0 ?

Gilles Caulier
Comment 7 caulier.gilles 2016-07-04 08:43:25 UTC
This file still valid using digiKam 5.0.0 ?

Gilles Caulier
Comment 8 caulier.gilles 2016-07-28 14:06:33 UTC
Git commit d0a60f5f02890de9e5a5a3e312511930f3cf72a5 by Gilles Caulier.
Committed on 28/07/2016 at 13:54.
Pushed by cgilles into branch 'master'.

Update internal Libraw to 0.18.0 beta (July 2016).

Move Libraw samples compilation rules to core/tests/rawengine. Theses samples
files are now only generated if test code are compiled through right CMake option.

Use DNG SDK source code to compile Libraw in goal to:
   - Decode DNG analog color balances
   - Decode DNG channel black/white level
   - 8-bit encoded DNG files
   - Deflate compressed DNG support with zlib

New features:
   - Support for Black and White Jpeg previews
   - Better intepolation of low-sensitivity pixels on Sigma Quattro files

New RAW cameras supported:
   - BlackMagic Micro Cinema Camera, URSA Mini
   - Canon 80D, 1300D, 1DX MkII
   - Fujifilm X-Pro2 (uncompressed RAW only), X70, X-E2S
   - HTC One A9 and M9
   - Leica M (Typ 262) and X-U (Typ 113)
   - Nikon D5
   - Olympus Pen F, SH-3
   - Panasonic DMC-GX80/85, DMC-TZ80/81/85/ZS60, DMC-TZ100/101/ZS100
   - PhaseOne IQ150, IQ180 IR, IQ3 (all models)
   - Samsung Galaxy S7 (SM-G935F)
   - Sony ILCA-68, ILCE-6300, RX1R II, RX10 III
   - YUNEEC CGO4
Related: bug 257737, bug 347010, bug 366095

M  +12   -0    NEWS
M  +32   -28   libs/rawengine/libraw/CMakeLists.txt
M  +5    -1    libs/rawengine/libraw/COPYRIGHT
M  +104  -0    libs/rawengine/libraw/Changelog.txt
M  +1    -1    libs/rawengine/libraw/crlf2lf.sh
M  +1752 -413  libs/rawengine/libraw/internal/dcraw_common.cpp
M  +2    -2    libs/rawengine/libraw/internal/dcraw_fileio.cpp
M  +10   -6    libs/rawengine/libraw/internal/defines.h
M  +2    -2    libs/rawengine/libraw/internal/demosaic_packs.cpp
D  +0    -142  libs/rawengine/libraw/internal/libraw_bytebuffer.h
M  +12   -2    libs/rawengine/libraw/internal/libraw_internal_funcs.h
M  +29   -29   libs/rawengine/libraw/internal/libraw_x3f.cpp
M  +1    -1    libs/rawengine/libraw/internal/var_defines.h
M  +98   -98   libs/rawengine/libraw/internal/wf_filtering.cpp
M  +43   -22   libs/rawengine/libraw/libraw/libraw.h
M  +3    -3    libs/rawengine/libraw/libraw/libraw_alloc.h
M  +89   -24   libs/rawengine/libraw/libraw/libraw_const.h
M  +61   -2    libs/rawengine/libraw/libraw/libraw_datastream.h
M  +19   -14   libs/rawengine/libraw/libraw/libraw_internal.h
M  +360  -166  libs/rawengine/libraw/libraw/libraw_types.h
M  +4    -4    libs/rawengine/libraw/libraw/libraw_version.h
M  +8    -8    libs/rawengine/libraw/samples/4channels.cpp
M  +46   -43   libs/rawengine/libraw/samples/dcraw_emu.cpp
M  +1    -1    libs/rawengine/libraw/samples/dcraw_half.c
M  +1    -1    libs/rawengine/libraw/samples/half_mt.c
M  +1    -1    libs/rawengine/libraw/samples/half_mt_win32.c
M  +9    -9    libs/rawengine/libraw/samples/mem_image.cpp
M  +6    -6    libs/rawengine/libraw/samples/multirender_test.cpp
M  +23   -23   libs/rawengine/libraw/samples/postprocessing_benchmark.cpp
M  +192  -11   libs/rawengine/libraw/samples/raw-identify.cpp
M  +10   -10   libs/rawengine/libraw/samples/simple_dcraw.cpp
M  +9    -9    libs/rawengine/libraw/samples/unprocessed_raw.cpp
M  +11   -3    libs/rawengine/libraw/src/libraw_c_api.cpp
M  +1150 -167  libs/rawengine/libraw/src/libraw_cxx.cpp
M  +86   -85   libs/rawengine/libraw/src/libraw_datastream.cpp
M  +43   -0    tests/rawengine/CMakeLists.txt

http://commits.kde.org/digikam/d0a60f5f02890de9e5a5a3e312511930f3cf72a5
Comment 9 Dav 2016-11-01 10:46:22 UTC
Hello,

this report duplicate #369668
Comment 10 caulier.gilles 2016-11-01 15:18:27 UTC
*** Bug 369668 has been marked as a duplicate of this bug. ***
Comment 11 caulier.gilles 2016-11-01 17:11:53 UTC
Git commit 2c67e6ffd23d8e7fda2704e875378b7f2da20905 by Gilles Caulier.
Committed on 01/11/2016 at 17:00.
Pushed by cgilles into branch 'master'.

Internal Libraw updated to 0.18-beta1 with 78 cameras added,
floating point DNG support, decode exotic DNG formats e.g. 8-bit DNG,
and more metadata parsed while decoding as white balance presets,
DNG colordata, vendor specific metadata.

See Libraw announcement for details : http://www.libraw.org/news/libraw-0-18-beta1
Related: bug 368862, bug 367640, bug 257737, bug 347010

FIXED-IN: 5.3.0

M  +5    -0    NEWS
M  +1    -5    libs/rawengine/libraw/COPYRIGHT
M  +230  -235  libs/rawengine/libraw/Changelog.txt
M  +0    -0    libs/rawengine/libraw/LICENSE.CDDL
M  +0    -0    libs/rawengine/libraw/LICENSE.LGPL
M  +4    -5    libs/rawengine/libraw/README
A  +34   -0    libs/rawengine/libraw/README.DNGSDK.txt
M  +1    -4    libs/rawengine/libraw/internal/aahd_demosaic.cpp
M  +1682 -1038 libs/rawengine/libraw/internal/dcraw_common.cpp
M  +1    -4    libs/rawengine/libraw/internal/dcraw_fileio.cpp
M  +3    -6    libs/rawengine/libraw/internal/defines.h
M  +1    -10   libs/rawengine/libraw/internal/demosaic_packs.cpp
M  +1    -4    libs/rawengine/libraw/internal/dht_demosaic.cpp
M  +16   -6    libs/rawengine/libraw/internal/libraw_internal_funcs.h
M  +1080 -551  libs/rawengine/libraw/internal/libraw_x3f.cpp
M  +1    -3    libs/rawengine/libraw/internal/var_defines.h
M  +1    -10   libs/rawengine/libraw/internal/wf_filtering.cpp
M  +29   -21   libs/rawengine/libraw/libraw/libraw.h
M  +1    -4    libs/rawengine/libraw/libraw/libraw_alloc.h
M  +10   -32   libs/rawengine/libraw/libraw/libraw_const.h
M  +5    -8    libs/rawengine/libraw/libraw/libraw_datastream.h
M  +2    -6    libs/rawengine/libraw/libraw/libraw_internal.h
M  +67   -28   libs/rawengine/libraw/libraw/libraw_types.h
M  +3    -6    libs/rawengine/libraw/libraw/libraw_version.h
M  +1    -5    libs/rawengine/libraw/samples/4channels.cpp
M  +51   -10   libs/rawengine/libraw/samples/dcraw_emu.cpp
M  +1    -5    libs/rawengine/libraw/samples/dcraw_half.c
M  +1    -4    libs/rawengine/libraw/samples/half_mt.c
M  +1    -4    libs/rawengine/libraw/samples/half_mt_win32.c
M  +1    -4    libs/rawengine/libraw/samples/mem_image.cpp
M  +1    -5    libs/rawengine/libraw/samples/multirender_test.cpp
M  +1    -6    libs/rawengine/libraw/samples/postprocessing_benchmark.cpp
M  +124  -20   libs/rawengine/libraw/samples/raw-identify.cpp
M  +16   -5    libs/rawengine/libraw/samples/simple_dcraw.cpp
M  +2    -5    libs/rawengine/libraw/samples/unprocessed_raw.cpp
M  +38   -3    libs/rawengine/libraw/src/libraw_c_api.cpp
M  +458  -100  libs/rawengine/libraw/src/libraw_cxx.cpp
M  +1    -4    libs/rawengine/libraw/src/libraw_datastream.cpp
A  +811  -0    libs/rawengine/libraw/src/libraw_xtrans_compressed.cpp     [License: UNKNOWN]  *

The files marked with a * at the end have a non valid license. Please read: http://techbase.kde.org/Policies/Licensing_Policy and use the headers which are listed at that page.


http://commits.kde.org/digikam/2c67e6ffd23d8e7fda2704e875378b7f2da20905
Comment 12 caulier.gilles 2016-11-25 16:04:39 UTC
Any feedback with current AppImage bundle for Linux ?

https://drive.google.com/drive/folders/0BzeiVr-byqt5Y0tIRWVWelRJenM

Gilles Caulier
Comment 13 Dav 2016-12-15 11:34:25 UTC
Created attachment 102793 [details]
Exifs tags differences between the original RAW file and the generated JPG coming from batch queue manager / convert into JPG process
Comment 14 Dav 2016-12-15 11:40:12 UTC
Hello,

I'm Still having this issue under digikam 5.3 coming from PPA under Ubuntu X64 distribution (Version 5.3, Using:
KDE Frameworks 5.18.0
Qt 5.5.1 (built against 5.5.1)
The xcb windowing system)

exiftool -Orientation /home/marc/pictures/343A5594.CR2
Orientation                     : Rotate 90 CW
process this raw file with batch processing / convert into JPG (JPG quality 100, 4.4.4) generate a 343A5594.JPG file
exiftool -Orientation /home/marc/pictures/343A5594.jpg
Orientation                     : Horizontal (normal)

exifool /home/marc/pictures/343A5594.CR2 | sort > /tmp/cr2.txt
exifool /home/marc/pictures/343A5594.jpg | sort > /tmp/jpg.txt
diff /tmp/cr2.txt /tmp/jpg.txt --suppress-common-lines > /tmp/diff_exifs_tags_between_raw_and_generated_jpg.txt

file has been attached to this post.
Comment 15 Dav 2017-01-13 11:01:47 UTC
Hello,

not reproduced within the 5.4 release!