Я не использовал это некоторое время, но, надеюсь, это поможет. Создайте пакетный скрипт gimp (я называю мой crop-png.scm) и поместите его в ~/.gimp-2.6/scripts/).
(define (crop-png filename)
(let*
(
(image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
(drawable (car (gimp-image-get-active-layer image)))
)
; crop the image
(plug-in-autocrop RUN-NONINTERACTIVE image drawable)
; save in original png format
(file-png-save RUN-NONINTERACTIVE image drawable filename filename
0 6 0 0 0 1 1)
; clean up the image
(gimp-image-delete image)
)
)
Затем сохраните этот сценарий оболочки (например, pngcrop.sh) и вызовите его для файлов png, например: 'pngcrop.sh * .png'
#!/bin/bash
if [ $# -le 0 ]; then
echo
echo "Usage: $(basename $0) file1.png [file2.png ...]"
echo
echo " This script uses gimp to autocrop PNG files and"
echo " save them to PNG format. You must have"
echo " crop-png.scm installed in your gimp "
echo " scripts directory."
echo
exit 1
fi
# set the filelist
files=$*
# # set the base command
# CMD="gimp -i -b "
# loop and add each file
for i in ${files[*]} ; do
# #echo $i
# ARGS="\"(crop-png \\\"$i\\\")\""
# CMD="$CMD $ARGS"
gimp -i -b "(crop-png \"$i\")" -b "(gimp-quit 0)"
done
# # add the end to quit
# TAIL="-b \"(gimp-quit 0)\""
# CMD="$CMD $TAIL"
#
# #echo $CMD
# eval $CMD