My other car is a cdr, or GIMP LISP scripting
Say you have to convert a hundred images, scaling and padding them... How to go on about it? Fire up your favorite image editor, painstakingly repeat the same operation over and over, develop RSI and curse the world.
Unless you're a software engineer. GIMP is easily scriptable, if you know LISP. Fire up gimp with gimp --batch - . Open up the Xtns | DB Browser for help reference, and hack away:
My particular script looks like this:
gimp-2.0 --batch - > /dev/null << EOFMARKER
(set! img (car (file-jpeg-load 1 "${SOURCEICON}" "${SOURCEICON}")))
(set! width (car (gimp-image-width img)))
(set! height (car (gimp-image-height img)))
(gimp-image-scale img 120 (trunc (/ (* height 120) width)))
(set! height (car (gimp-image-height img)))
(gimp-palette-set-background '(255 255 255))
(gimp-image-resize img 120 90 0 (trunc (/ (- 90 height) 2)))
(gimp-layer-resize-to-image-size (car (gimp-image-get-active-layer img)))
(file-jpeg-save 1 img (car (gimp-image-get-active-layer img))
"${TARGETICON}" "${TARGETICON}"
0.9 0 1 0 "" 0 1 0 2)
(gimp-quit 1)
EOFMARKER
