After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 162877 - rotation of misaligned images
rotation of misaligned images
Status: RESOLVED WONTFIX
Product: GIMP
Classification: Other
Component: Tools
2.2.x
Other All
: Normal enhancement
: ---
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2005-01-04 00:24 UTC by philippb
Modified: 2008-01-15 12:44 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch for gimp2.2.0 (2.17 KB, patch)
2005-01-04 00:33 UTC, philippb
rejected Details | Review

Description philippb 2005-01-04 00:24:37 UTC
The attached patch adds a feature I am missing in Gimp since i saw it in Photoshop. 

I have a flatbed scanner and I often get images that are a bit rotated. To
correct that I have to use the measure the angle of one of the picture's edges.
Afterwards I have to use the rotate-tool to correct this angle.

This patch helps filling in the right angle for the rotation: The last measured
angle is stored and will be used to calculate a default angle for future rotations.

Rotation can be done like this: use the measure-tool to draw/measure a line that
should be exactly horizontal/vertical. Open the rotate-tool. Press 'Rotate',
Finished!

This is my first contribution to the OS community, so Im pretty shure this patch
isnt perfect yet. (I just defined a new variable somewhere inside gimp.c to
store the angle....)
Comment 1 philippb 2005-01-04 00:33:05 UTC
Created attachment 35411 [details] [review]
patch for gimp2.2.0
Comment 2 Sven Neumann 2005-01-04 00:33:46 UTC
Why don't you just use the Corrective transform feature of the Rotate tool? Just
align the grid with your misaligned image and have GIMP rotate it back. Closing
the report as WONTFIX since your feature is already implemented, just better.
Comment 3 philippb 2005-01-04 00:46:21 UTC
Hmm, I must admit that I dont like that method. For me it takes some effort to
get the exact angle this way. These grid lines never are where I want them to be
and its always like: 'are these two lines parallel? they look like...'
Comment 4 weskaggs 2005-01-04 18:44:04 UTC
The problem with your solution is that it makes things easier for you but
slightly harder for almost everybody else (who rarely do the same rotation over
and over).  If you can come up with a solution that does not have this problem,
we might be more receptive.  You might think, for example, of saving the
rotation value in a way that allows it to be accessed by a script or plugin but
does not use it to set the default; you could then write a simple
"repeat-previous-rotation" script.

Note also, for future reference, that your patch does not completely folow GIMP
coding style.  Thus, instead of 

tmp_angle=fmod((tmp_angle+45),90)-45;

you should have

tmp_angle = fmod ((tmp_angle + 45), 90) - 45;

But this is less important than the usability issue.
Comment 5 philippb 2005-01-04 21:18:32 UTC
I dont want to do the same rotation over and over. Therefore it really sounds a
bit odd to use some value as default for all rotations.

But 'my' default value is always between -45 and +45 degrees. At the moment a
default of 0 is used. I understand that it could be a little bit confusing to
have a none-zero default value, but I wont call that an issue: You never want to
do a rotation by zero degrees, so you have to adjust the angle anyway. And 45
degrees is not too far away from zero...

Maybe there could be a button inside the transfom menu to fill in that stored
value, but that would be one click more for my method and I cant see the
usability issue yet.

What about a checkbox inside the preferences to toggle between my patch and a
zero-default?
Comment 6 Sven Neumann 2005-01-06 15:01:16 UTC
Using the measure tool in combination with the rotate tool is completely
unintuitive. If at all, we would want to add this functionality in the rotate
tool. Your patch is a bad hack and completely unacceptable, even after cleaning
up the coding style issues. I also don't think we should make the results of the
measure tool available to the PDB. It's purely a user interface thing and thus
doesn't belong into the PDB.
Comment 7 weskaggs 2005-01-06 17:32:19 UTC
Here is another thought:  use the path tool instead of the measure tool, to
create a simple straight-line path.  You can then write a script that uses
gimp-path-get-current to get the path you just created, gimp-path-get-points to
extract the first two points, a little math to calculate the angle, then
gimp-image-rotate to rotate by that angle, then gimp-path-delete to remove the
path. 
Comment 8 Sven Neumann 2005-01-06 17:50:44 UTC
/me shudders. Why not simple add a mode to the rotate tool that allows to adjust
a line and use that information to rotate the image? That's what this report is
all about, no?
Comment 9 weskaggs 2005-01-06 20:09:32 UTC
Because the bug was resolved as WONTFIX, and I wanted to suggest a solution that
didn't require arguing about it.

Reopening based on comment #8.
Comment 10 Alexandre Prokoudine 2006-09-26 06:14:50 UTC
"Using the measure tool in combination with the rotate tool is completely
unintuitive."

Sven, please consider not referring to intuition as it's not evenly distributed across mankind. I've seen far too many users complaining about Measure tool not telling Rotate tool the measured angle. In fact, if you google for "straighten horizon" you'll see that combination of measure tool and rotate tool for straightening horizon is widely used.

Backward mode of rotate tool a) is not really a discoverable solution and b) doesn't give enough precision, where as aforementioned combination does.

Bill's suggestion to use path tool and calculate from its endpoint is logical (in fact hugin, panorama tool, uses a similar approach by calculating angle from two control points), but, sadly, same non-discoverable. A more obvious way could be a new tool based on Measure and Rotate tool that would do what Bill described: draw a line, automatically calculate from endpoints and rotate.
Comment 11 Sven Neumann 2006-09-26 07:27:45 UTC
That could as well be part of the Rotate tool then. But seriously, there's not much need for a change here because we have the very powerful backward mode of the transform tools. It's somewhat redundant to talk about this further. If someone wants to see this improved, he/she should provide a patch.
Comment 12 Sven Neumann 2007-05-23 11:28:48 UTC
We plan to include the Deskew plug-in at some point (http://www.cubewano.org/gimp-deskew-plugin/). This would probably make this request obsolete.
Comment 13 Raphaël Quinet 2007-05-24 11:13:23 UTC
By the way, my usual way to use the rotate tool in corrective mode is to first drag one or several guides onto the image so that I have reference lines exactly where I want them, then rotate and align the features in the image with the guides.  I do not see any advantages that the measure tool could have over that method, so I still suggest WONTFIX for this report (or OBSOLETE if Deskew is included).
Comment 14 Sven Neumann 2007-05-25 06:18:07 UTC
Closing as WONTFIX since we seem to agree that the suggested approach is flawed.