Bug 179766 - Auto crop does not fully remove black corners created by free rotation
Summary: Auto crop does not fully remove black corners created by free rotation
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Plugin-Editor-Rotation (show other bugs)
Version: 0.10.0
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-05 23:50 UTC by Gandalf Lechner
Modified: 2016-06-30 11:53 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 1.0.0


Attachments
screenshot (33.54 KB, image/jpeg)
2009-01-06 13:50 UTC, Gandalf Lechner
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gandalf Lechner 2009-01-05 23:50:48 UTC
Version:           unknown (using 4.1.85 (KDE 4.1.85 (KDE 4.2 Beta2)), Kubuntu packages)
Compiler:          cc
OS:                Linux (x86_64) release 2.6.27-7-generic

When using the free rotation tool, the rotated image is put into an upright rectangle such that the corners are black triangles. The auto crop options of this tool are supposed to crop the picture to the widest or largest upright rectangle selection avoiding these areas. But in the current version, using the auto crop option often leaves parts of the black background triangles in the cut final image, for sure an undesired effect.
Comment 1 caulier.gilles 2009-01-06 06:34:59 UTC
I let's black frame as well, or a part is croped ?

Image is really rotated ?

Gilles Caulier
Comment 2 Gandalf Lechner 2009-01-06 13:50:28 UTC
Created attachment 29969 [details]
screenshot

picture showing the result of free rotation without and with auto crop
Comment 3 caulier.gilles 2009-01-26 11:30:14 UTC
I confirm this problem with KDE4 and KDE3.

It's another side effect of Editor Tool port (i think)

Gilles
Comment 4 Andi Clemens 2009-02-18 20:41:42 UTC
This seems only to be true for portrait oriented images, landscape oriented works fine here.
Comment 5 caulier.gilles 2009-02-19 09:54:26 UTC
The question is why? The code in this plugin (algorithm) is unchanged since a while.

The only way to check is Editor Tool api port. This problem appear since plugin dialog have been removed.

Perhaps a slots/signal race condition when plugin widget is raised from widget stack ?

Gilles
Comment 6 Andi Clemens 2009-04-07 18:55:17 UTC
By quickly looking over the filter I ask myself if the auto-crop algorithms were only written for landscape images?
Neither WidestArea nor LargestArea are working correctly if used with portrait images.
Comment 7 caulier.gilles 2009-04-07 19:06:56 UTC
One of algorithm have been written by Gerhard Kulzer. Ask to him...

Other one, By Renchi Raju if i remember (not available in team now...)

Look comments in code for details

Gilles
Comment 8 Gerhard Kulzer 2009-04-08 09:27:19 UTC
I'll have a look
Gerhard
Comment 9 Andi Clemens 2009-04-26 20:09:58 UTC
Is this auto crop code "borrowed" from Gimp? Because in Gimp auto-cropping portrait images also doesn't work. If you set clipping in Gimp to "crop to result", it works (seems to be what we call "widest area" in our tool.
But if you set clipping to "crop with aspect", it just shows a transparent layer, at least on my machine (Gimp 2.6.6).
Comment 10 Andi Clemens 2009-05-24 15:03:51 UTC
I just installed KDE3 again (what a pain) to test this feature here.
I checked out everything from May 2008 till now and compiled it. Even in May last year the crop didn't work so I don't think this is related to the changes of the image editor. If this feature really worked before, it must have been in 2007 or so, because no significant changes where made to imageplugins/freerotation/freerotation.cpp tool in the last 1 1/2 year.

I would assume it never worked. Unfortunately I'm not able to go back even more in time, because everything below May 2008 will not compile here anymore.

Andi
Comment 11 Andi Clemens 2009-05-24 19:30:19 UTC
I checked out a VERY old version of the digikamimageplugins package from the SVN repository. Even the version from 2005 doesn't differ from the current one, so I would really assume it never worked for horizontal images.
Actually this can't be so hard to fix, I will take a look at it, too.
It's been a while since I had math classes, but I will try to analyze the code now.

Andi
Comment 12 Andi Clemens 2009-05-24 19:37:19 UTC
(In reply to comment #11)
> ... so I would really assume it never worked for horizontal images.

Vertical / Portrait I mean.
Comment 13 Andi Clemens 2009-05-30 15:29:16 UTC
*** Bug 194660 has been marked as a duplicate of this bug. ***
Comment 14 Andi Clemens 2009-05-30 17:19:54 UTC
SVN commit 975580 by aclemens:

First attempt to fix auto-crop: I played around with the algorithm a
little and it seems to work quite well.
Can you confirm this?

Andi

CCBUG:179766

 M  +50 -28    freerotation.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=975580
Comment 15 Andi Clemens 2009-05-30 17:21:28 UTC
I only touched "Largest area" for now...

Andi
Comment 16 Andi Clemens 2009-05-30 17:53:25 UTC
I will close this one now, it should work for others, too :-D
"Widest Area"-Crop seems to be ok.

Andi
Comment 17 Mikolaj Machowski 2009-05-31 15:31:10 UTC
There is strange bug:

When selecting Largest Area in options image is moved one pixel up and right and along longer border appear black stripe. Looks like this doesn't affect final output. Only preview problem.
Comment 18 Andi Clemens 2009-05-31 15:37:43 UTC
Yes, I know. Preview bug, because no rotation took place and so no cropping is done. Don't know why... but the final will not be cropped.
Comment 19 Andi Clemens 2009-05-31 15:38:27 UTC
Hmm maybe we can ignore slotEffect when angle is 0.0. So this bug should be gone. Will try this.