libvips/tools/shrink_width

19 lines
367 B
Plaintext
Raw Normal View History

2009-08-16 17:00:08 +02:00
#!/bin/sh
# shrink to a target width
# default prefix
VIPSHOME=${VIPSHOME-/home/john/vips}
2009-08-16 17:00:08 +02:00
name=$0
bname=`basename $0`
if [ $# != 3 ]; then
echo "${bname}: usage: $bname <in> <out> <target width>"
exit 1
fi
inwidth=`$VIPSHOME/bin/vips im_header_int Xsize $1`
factor=`(echo scale=10; echo $inwidth / $3) | bc`
$VIPSHOME/bin/vips im_shrink $1 $2 $factor $factor