Image Rotation Auto Center
This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.
This is a read-only list on gimpusers.com so this discussion thread is read-only, too.
Image Rotation Auto Center | Stratos | 26 Nov 19:56 |
Image Rotation Auto Center | rich404 | 26 Nov 20:58 |
Image Rotation Auto Center | Stratos | 26 Nov 21:57 |
Image Rotation Auto Center | Ofnuts | 10 Dec 20:55 |
Image Rotation Auto Center | programmer_ceds | 11 Dec 20:35 |
Image Rotation Auto Center | Stratos | 11 Dec 21:20 |
Image Rotation Auto Center | programmer_ceds | 12 Dec 11:03 |
- postings
- 3
Image Rotation Auto Center
I'm looking for a way to set the auto center for rotation to 53, 672 instead of the image center. I have 1200 images to process and reducing even a few keystrokes makes a big difference. tks, S
Image Rotation Auto Center
I'm looking for a way to set the auto center for rotation to 53, 672 instead of the image center. I have 1200 images to process and reducing even a few keystrokes makes a big difference. tks, S
Is it a different amount of rotation for each image?
If the rotation is constant, the the batch plugin BIMP can be used.
- postings
- 3
Image Rotation Auto Center
Unfortunately, no. This task is to bring all the images into axial alignment, They vary from +12 deg to -12 deg out of alignment more or less randomly.
Image Rotation Auto Center
On 11/26/17 20:56, Stratos wrote:
I'm looking for a way to set the auto center for rotation to 53, 672 instead of the image center. I have 1200 images to process and reducing even a few keystrokes makes a big difference. tks, S
Several ideas, depending on what you have to do and how good you are at scripting...
1) with ofn-preset-guides(*) you can define a pair of guides that intersect at (53,672) and add it to your image with one single keystroke (and add a keyboard shortcut to it, using Edit>Preferences>Shortcut). Then you can very quickly drag the center of rotation to that point when you are in the rottion tool.
2) with ofn-layer-straightener(*) you put two points on your image (using the Paths tool) (for instance on what should be the horizon, or what should be a vertical on a building), and the script determines the angle or rotation to apply to make that line on the image exactly vertical or horizontal. The script rotates the image around its center, but editing to force a different center of rotation is easy.
3) in addition to either of the above, ofn-file-next(*) can help you process files in sequence if their name contains a sequence number. With one keystroke, it will save the current file and open the next in the sequence.
(*) all the scripts can be dowloaded from here: https://sourceforge.net/projects/gimp-tools/files/scripts/ The ZIP also contains the doc. For more help with these scripts see https://www.gimp-forum.net/Forum-Extending-the-GIMP
- postings
- 121
Image Rotation Auto Center
I'm looking for a way to set the auto center for rotation to 53, 672 instead of the image center. I have 1200 images to process and reducing even a few keystrokes makes a big difference. tks, S
If you are able to build GIMP from source you could edit the following lines in function gimp_rotate_tool_prepare() in gimprotatetool.c/.
Change the lines: tr_tool->trans_info[PIVOT_X] = (gdouble) (tr_tool->x1 + tr_tool->x2) / 2.0; tr_tool->trans_info[PIVOT_Y] = (gdouble) (tr_tool->y1 + tr_tool->y2) / 2.0;
to read:
tr_tool->trans_info[PIVOT_X] = (gdouble) 672; tr_tool->trans_info[PIVOT_Y] = (gdouble) 53;
(Ideally the rotate tool would remember the last centre of rotation (at least for the current session of GIMP) and have a button that you could use to reset the centre of rotation to the centre of the image).
and when you activate the rotate tool the centre of rotation will be set as you want it.
Alternatively Ofnuts suggestion 2) (or a variant of it) would be your best bet. How do you determine the angle of rotation?
- postings
- 3
Image Rotation Auto Center
If you are able to build GIMP from source you could edit the following lines in function gimp_rotate_tool_prepare() in gimprotatetool.c/.
Change the lines: tr_tool->trans_info[PIVOT_X] = (gdouble) (tr_tool->x1 + tr_tool->x2) / 2.0;
tr_tool->trans_info[PIVOT_Y] = (gdouble) (tr_tool->y1 + tr_tool->y2) / 2.0;to read:
tr_tool->trans_info[PIVOT_X] = (gdouble) 672; tr_tool->trans_info[PIVOT_Y] = (gdouble) 53;
(Ideally the rotate tool would remember the last centre of rotation (at least for the current session of GIMP) and have a button that you could use to reset the centre of rotation to the centre of the image).
and when you activate the rotate tool the centre of rotation will be set as you want it.
Alternatively Ofnuts suggestion 2) (or a variant of it) would be your best bet. How do you determine the angle of rotation?
Got deflected onto another task for a few days. I will try both these approaches this week. What I am doing is comparing the hydrodynamic centerline of dolphin fins.
"How do you determine the angle of rotation?" Each fin has a unique centerline, but each photo has a rotational bias imposed by the photographers' technique, environmental conditions and such. Once I establish the root of the fin and centerline, I paste that as new layer over a protractor image with a center-point of 53,672 (an artifact of the protractor image nothing more). Then I use the rotate tool to move the centerline to 40 degrees. The angular correction measured for the line becomes the correction for the fin photo. With the fin photo rotated it can now be compared fin-to-fin with other images corrected in a similar way.
- postings
- 121
Image Rotation Auto Center
If I'm understanding correctly then you can make the task much easier.
Create a script that uses a two point path. The first point of the path to be defined is the centre of rotation (the point that gives the x,y offset by which the image must be moved) and the gradient of the straight line joining the ends of the path gives the rotation that must be made.
The script should delete the path before it finishes to save you doing this before processing the next image.
Remember that GIMP works in radians not degrees.
Whilst, for this application, the script doesn't need to offer user adjustable parameters it might be as well to have parameters for the coordinates of the centre of rotation and the angle (set the default values to 53, 672 and 40 degrees) - at least this would act as an aide memoire and at best it would allow someone to use different values without editing the default values.
The work flow would then be:
Firstly I would create a folder with copies of all of the images to be modified and use a file renaming program to add _rotated to the end of each file name. Then you will still have the original images and can use the overwrite option - which will cut down on the number of key strokes.
Open an image
Make sure the path tool is selected (this should stay selected from image to image during the GIMP session)
Click where the centre of rotation is to be to define the first point of the path
Click to define the angle (the second point of the path)
Run the script (for the first image you will have to activate the script and press Enter - for subsequent
images just press Ctrl-F)
Save the image (File/Overwrite xxxxxx)
Let me know if you have problems writing a script.
The following is more complicated than you need but does show path handling:
http://www.programmer97.talktalk.net/Files/arrow.zip
Hope this helps.
Got deflected onto another task for a few days. I will try both these approaches this week. What I am doing is comparing the hydrodynamic centerline of dolphin fins.
"How do you determine the angle of rotation?" Each fin has a unique centerline, but each photo has a rotational bias imposed by the photographers' technique, environmental conditions and such. Once I establish the root of the fin and centerline, I paste that as new layer over a protractor image with a center-point of 53,672 (an artifact of the protractor image nothing more). Then I use the rotate tool to move the centerline to 40 degrees. The angular correction measured for the line becomes the correction for the fin photo. With the fin photo rotated it can now be compared fin-to-fin with other images corrected in a similar way.