Bug 343013

Summary: CANVAS : on working with raw images marked square isn't crop accurate [patch]
Product: [Applications] digikam Reporter: Florian Gross <florian>
Component: ImageEditor-CanvasAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: major CC: caulier.gilles, metzpinguin
Priority: NOR    
Version: 4.4.0   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
URL: http://grossing.org/temp/showfoto.mp4
Latest Commit: Version Fixed In: 4.7.0
Sentry Crash Report:
Attachments: originalsize.patch

Description Florian Gross 2015-01-18 19:12:56 UTC
When working with an image in raw format e.g. .cr2 or .arw the marked square isn't cut accurate at the marking lines.


Reproducible: Always

Steps to Reproduce:
1. start showfoto
2. load an .cr2 e.g. http://grossing.org/temp/IMG_8249.CR2
3. mark an area
4. Press Ctrl-x or use Transform -> crop

Actual Results:  
There is something near the marked square cropped, but not exact the marked area, see linked movie

Expected Results:  
crop at the marked square

Tested with versions 4.4.0 and 4.6.0
Comment 1 caulier.gilles 2015-01-18 19:26:13 UTC
Problably fixed with last 4.6.0 release by Maik Qualmann...

Gilles Caulier
Comment 2 caulier.gilles 2015-01-18 19:27:18 UTC
Florian,

RAW or JPEG as no difference with crop tool. Can you try with a JPEG file to see if it's reproducible ?

Gilles Caulier
Comment 3 Florian Gross 2015-01-18 19:46:28 UTC
I'll try. At the moment i couldn't reproduce the problem wheater with JPEG nor RAW
Comment 4 Maik Qualmann 2015-01-18 19:49:43 UTC
Yes, here is a problem with the (CR2?) RAW images. The first cut after the load is wrong. After undo everything is ok. I think the attribute "originalSize", in this RAW Image not set correctly when loading.

Maik
Comment 5 Maik Qualmann 2015-01-18 21:11:44 UTC
After an initial review, I see the bug in libkdcraw. When a RAW image in portrait mode (even with my Nikon NEF) the width and height of the image is reversed in the libkdcraw container. An old Fujifilm RAW has a completely wrong size. I think we will be installing a workaround for now.
Comment 6 caulier.gilles 2015-01-18 21:57:08 UTC
Maik,

The RAW image size is not get from libkdcraw, but from libkexiv2, if i remember.

libkdcraw (libraw in fact in background) is used only for RAW files not supported by Exiv2.

It's possible that a confusion is done by Exiv2 with TIFF/EP based RAW files. There are a lots of tags dedicated to manage image size.

Florian, did you use RawImport tool in editor, or you load RAW file directly as with JPEG ?

Gilles Caulier
Comment 7 Florian Gross 2015-01-18 22:22:58 UTC
(In reply to Gilles Caulier from comment #6)

> Florian, did you use RawImport tool in editor, or you load RAW file directly
> as with JPEG ?

I copied the RAW files via card reader from a sd card. No import functions were used
Comment 8 caulier.gilles 2015-01-18 22:24:38 UTC
I talk about RAW Import tool from _Image Editor_. Look in Setup dialog...

Gilles Caulier
Comment 9 Florian Gross 2015-01-18 22:33:33 UTC
(In reply to Gilles Caulier from comment #8)
> I talk about RAW Import tool from _Image Editor_. Look in Setup dialog...

Oh sorry. I translate from the german dialog: fast and easy as 8bit. I hope this helps, otherwise i have to look for some pictures with the english dialog

flo
Comment 10 caulier.gilles 2015-01-18 22:36:25 UTC
So, you don't use Import Tool.

Try to check if Import tool made a difference here

Gilles Caulier
Comment 11 Florian Gross 2015-01-18 22:51:46 UTC
The first try: http://grossing.org/temp/IMG_8249_imp1.jpg
the second try: http://grossing.org/temp/IMG_8249_imp2.jpg

cropped area is much deferred in comparison to the marked area

flo
Comment 12 Florian Gross 2015-01-18 22:53:19 UTC
the marked areas right end is the right end of the red stripe

flo
Comment 13 Maik Qualmann 2015-01-19 18:43:12 UTC
Created attachment 90522 [details]
originalsize.patch

This patch fixes the problem with the RAW files when loading. And I have the IF statements removed from my patch, are not required.
Comment 14 caulier.gilles 2015-01-22 10:17:37 UTC
Git commit 76657579a2101a0c721544da238a24ec4a195e92 by Gilles Caulier.
Committed on 22/01/2015 at 10:15.
Pushed by cgilles into branch 'master'.

Apply patch #90522 from MAik Qualmann to fix stored original RAW image size loaded in Image Editor
FIXED-IN: 4.7.0

M  +2    -1    NEWS
M  +1    -0    utilities/imageeditor/core/editorcore.cpp
M  +2    -10   utilities/imageeditor/core/editorcore_p.h

http://commits.kde.org/digikam/76657579a2101a0c721544da238a24ec4a195e92
Comment 15 caulier.gilles 2015-01-22 10:25:39 UTC
Git commit 3b2a9baaf5afd64a8ac1c45bb9491450df643f11 by Gilles Caulier.
Committed on 22/01/2015 at 10:24.
Pushed by cgilles into branch 'frameworks'.

backport patch #76657579a2101a0c721544da238a24ec4a195e92 from git/master to frameworks branch

M  +1    -16   utilities/imageeditor/core/editorcore.cpp
M  +3    -11   utilities/imageeditor/core/editorcore_p.h

http://commits.kde.org/digikam/3b2a9baaf5afd64a8ac1c45bb9491450df643f11