[Digikam-devel] [Bug 128293] aspect ratio crop does not respect aspect ratio

Arnd Baecker arnd.baecker at web.de
Sat Jan 19 14:41:53 GMT 2008


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=128293         




------- Additional Comments From arnd.baecker web de  2008-01-19 15:41 -------
Roberto, 

I have tested the patch and I do think that the approach is really the
correct one. However, there are some issues, which are caused by 
the underlying problem of cropping to a specific aspect ratio.
Namely, this can only be achieved properly for certain combinations of
height/width:
For example, consider a 3 to 2 ratio. Changing the rectangle,
one may get to 1111/740 = 1.501351...
In contrast 1110/740 = 1.5 or 1119/746 =1.5 are ok.
So the question is, whether one wants to achieve the aspect ratio
only approximately, or precisely.
If we want to do it precisely, we have to think a bit harder.
Essentially it boils down to a restriction of the possible values for 
height and width, in dependence on the ratio:
  height = i * r_h
  width  = i * r_w
where the ratio = r_h : r_w .

But would it be possible to restrict the motion of the mouse to just
these values? Maybe one could just draw the rectangle
with the right height and width, which match closest
to the current mouse selection?

The same problem also arises with the input boxes: Here
all values are possible, but not necessarily lead to the precise
aspect ratio.I am not sure whether there is any good way to ensure
this properly for the text input?
One approach might be: after changing
a value in the input box the closest matching correct values
for H and W are determined and used.
This might give a slightly unusual feel, that
the values in the input box magically adapt. But maybe that's
the only way of ensuring precise values for the aspect ratio.

Another issue: Changes to the text input boxes
are not reflected in changes of the selected region.
I think that's what the timers were used for
(can't confirm this right now, because I only have the patched
svn version on  my machine ;-). So currently one has to use the
arrows near the entry box to activate the change.

Also, Dotan's example from #c4 with the aspect ratio 4:3:
Specifying 400 for the height, gives 299 for the width,
and 300 for the width 400 gives for the height.

Another minor issue: why do the sliders for width/height change
their position, if the selection region is moved with the mouse?

First we have to decide if we want to only use the precise
aspect ratio. I think we should, what do you think?

Best, Arnd



More information about the Digikam-devel mailing list