Script-FU: Batch rotate script - Printable Version +- Gimp-Forum.net (https://www.gimp-forum.net) +-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP) +--- Forum: Extending the GIMP (https://www.gimp-forum.net/Forum-Extending-the-GIMP) +---- Forum: Scripting questions (https://www.gimp-forum.net/Forum-Scripting-questions) +---- Thread: Script-FU: Batch rotate script (/Thread-Script-FU-Batch-rotate-script) |
Script-FU: Batch rotate script - dnairb - 02-03-2019 I am trying to write a batch rotate script, to rotate a number of images by an angle which is passed to the script. I have the following, which is successfully registered in Gimp: Code: (script-fu-register This is called in terminal by (to rotate each image by 35 degrees and save): Code: gimp -i -b '(script-fu-batch_arbitrary_rotate "*.png" 35)' -b '(gimp-quit 0)' The terminal output states: "batch command executed successfully", but the images are not rotated. The files' properties suggest that no operations were performed. I have racked my brains over this; can anyone help with the above script? RE: Script-FU: Batch rotate script - Ofnuts - 02-04-2019 Not a script-fu expert, but it looks like gimp-item-transform-rotate expects a layer/channel/path, not an image. If you want to rotate the image use gimp-image-rotate. RE: Script-FU: Batch rotate script - dnairb - 02-04-2019 Thank you for your reply. I looked at gimp-image-rotate, but Procedure Browser states that the rotate-type parameter only accepts ROTATE-90 (0), ROTATE-180 (1), ROTATE-270 (2). I want to be able rotate the images by an arbitrary angle. RE: Script-FU: Batch rotate script - programmer_ceds - 02-04-2019 (02-04-2019, 05:48 AM)Ofnuts Wrote: Not a script-fu expert, but it looks like gimp-item-transform-rotate expects a layer/channel/path, not an image. If you want to rotate the image use gimp-image-rotate.Sorry - misread the problem. Missed that the problem was about rotating the whole image. I guess the answer is to use gimp-item-transform-rotate on each of the layers in the image. Use gimp-image-get-layers to get a list of the layers in the image and iterate through them. RE: Script-FU: Batch rotate script - dnairb - 02-04-2019 (02-04-2019, 05:35 PM)programmer_ceds Wrote:(02-04-2019, 05:48 AM)Ofnuts Wrote: Not a script-fu expert, but it looks like gimp-item-transform-rotate expects a layer/channel/path, not an image. If you want to rotate the image use gimp-image-rotate.Sorry - misread the problem. Missed that the problem was about rotating the whole image. Each image has only 1 layer. RE: Script-FU: Batch rotate script - Ofnuts - 02-04-2019 Yes, I read the gimp-image-rotate description a bit too fast But yes, you likely have to rotate layers (in any case the save API also deals with layers and not images). |