Eu não uso isso há algum tempo, mas espero que ajude. Faça um script em lote gimp (eu chamo o meu crop-png.scm), e coloque-o em ~ / .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)
)
)
Em seguida, salve este script de shell (por exemplo, pngcrop.sh) e chame-o nos arquivos png da seguinte forma: '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