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:
This is called in terminal by (to rotate each image by 35 degrees and save):
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?
I have the following, which is successfully registered in Gimp:
Code:
(script-fu-register
"script-fu-batch_arbitrary_rotate"
"Batch Rotation"
""
""
""
""
"*"
)
(script-fu-menu-register "script-fu-batch_arbitrary_rotate" "<Image>/Tools/My scripts")
(
define (script-fu-batch_arbitrary_rotate pattern inDegrees)
(let*
(
(filelist (cadr (file-glob pattern 1)))
)
(while
(not (null? filelist))
(let*
(
(filename (car filelist))
(image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
(radians ( / (* inDegrees 4 (atan 1.0)) 180)) ;converts angle <inDegrees> to radians
(gimp-item-transform-rotate image radians FALSE 150 150)
(drawable (car (gimp-image-get-active-layer image)))
(gimp-file-save RUN-NONINTERACTIVE image drawable filename filename)
)
(set! filelist (cdr filelist))
)
)
)
)
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?