Появилась у меня задача, подогнать список фоток под заданный размер. Решил разобраться с языком Scheme, использующимся в Gimp 2.6 (как я смог понять, это аналог LISP) Собственно проблема в чем, при выполнении из Scheme Console всей последовательности команд, ошибки нет. Запускаю скрипт на работу с одним файлом - выдает ошибку. Как я смог понять падает на строчке "(gimp-image-resize image newWidth newHeight (/ (- newWidth (car (gimp-image-width image))) 2) 0)". При отдельном прописывании этой строчки в консоль Ским - все работает. Вот сам код, буду признателен за подсказки, в каком направлении копать.
(define (scale-and-resize file newWidth newHeight)
(let*
(
(image (car (gimp-file-load RUN-NONINTERACTIVE file "")))
(drawable (car (gimp-image-active-drawable image)))
(oldW (car (gimp-image-width image)))
(oldH (car (gimp-image-height image)))
)
(gimp-image-scale image (/ (* oldW newHeight) oldH) newHeight)
(gimp-image-resize image newWidth newHeight (/ (- newWidth (car (gimp-image-width image))) 2) 0)
(gimp-file-save RUN-NONINTERACTIVE image drawable file "")
)
)
(script-fu-register
"scale-and-resize" ;func name
"Scale And Resize" ;menu label
"Scale by height, and resize by width." ;description
"Alex Koeln-Frei" ;author
"copyright 2012, Alexandr Koeln-Frei" ;copyright notice
"April 17, 2012" ;date created
"" ;image type that the script works on
SF-STRING "Filename" ""
SF-VALUE "New Width" "298"
SF-VALUE "New Height" "376"
)
(script-fu-menu-register "scale-and-resize" "<Image>/Image/Transform")