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

Mark Ovens marko at freebsd.org
Sat Jan 6 12:46:01 GMT 2007


------- 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 marko freebsd org  2007-01-06 13:45 -------
I've been looking into this problem. I found that 640x480, 800x600, 1200x900, 1280x960 always work correctly but 1024x768 and 1152x864 (3:4 aspect ratio, i.e. same as a standard PC screen) never work.

If you resize, e.g. maximize, the Aspect Ratio Crop dialogue window then you get different errors and even 640x480, 800x600 etc. have errors too.

Looking at the code, what seems to be happening is that it takes the value you enter in the Height or Width spin-box and the selected aspect ratio then draws the selection rectangle in the preview window. Since the preview is not full-size the values have to be scaled. It does this calculation using floating point values then casts the results back to integers. Then, it takes the actual size of the selection rectangle in the preview window and scales the size back up to full-size (again as a floating point calculation with the results cast back to integers) and uses these values to populate the Height and Width spin-boxes. Both of these calculations have rounding errors so you don't get the values you expect.

What it should do is to apply the aspect ratio to the value - Height or Width - that you enter to calculate the other value and use those to draw the selection rectangle (which will only be an approximation as the preview is not full-size).

I am working to produce a patch to fix this.



More information about the Digikam-devel mailing list