e0d4ed89ff
The subdir in tools are no lonmger necessary. Also, remove ther old bin links feature, not very useful anymore.
46 lines
847 B
Bash
46 lines
847 B
Bash
#!/bin/sh
|
|
|
|
# Crop a set of image files
|
|
#
|
|
# usage:
|
|
#
|
|
# example% batch_crop left top width height image1 image2 etc
|
|
#
|
|
# writes output images crop_image1, crop_image2
|
|
|
|
# default prefix
|
|
VIPSHOME=${VIPSHOME-@prefix@}
|
|
|
|
name=`basename $0`
|
|
left=$1
|
|
top=$2
|
|
width=$3
|
|
height=$4
|
|
shift 4
|
|
|
|
# check args
|
|
if [ $# -lt 1 ]; then
|
|
echo "usage: $name left top width height image1 image2 ..."
|
|
echo
|
|
echo "$name writes a new set of images called crop_image1, "
|
|
echo "crop_image2, etc., each cropped to the specified size"
|
|
|
|
exit 1
|
|
fi
|
|
|
|
# convert each argument
|
|
for i in $*; do
|
|
dir=`dirname $i`
|
|
file=`basename $i`
|
|
new=$dir/crop_$file
|
|
echo "Cropping $file as $new ..."
|
|
|
|
if [ -f $new ]; then
|
|
echo "$new exists, skipping"
|
|
else
|
|
$VIPSHOME/bin/vips im_extract_area $i $new $left $top $width $height
|
|
fi
|
|
done
|
|
|
|
|