Imagemagick converting horizontal images

David Koski david at kosmosisland.com
Thu Feb 22 15:57:01 UTC 2007


Use identify:


	size=`identify "$f" | sed 's/[\ ]/\n/g' \
	| grep '^[0-9]*x[0-9]\+[0-9]\+' \
	| awk -F+ '{print $1}'`
	height=`echo $size | awk -Fx '{print $2}'`
	width=`echo $size | awk -Fx '{print $1}'`
	x=0
	y=0
	if [ $height -lt $width ]; then
	... do stuff ...

David Koski
david at kosmosisland.com

On Thursday 22 February 2007 05:17, Marcanth wrote:
> Hi,
>
> I have about 30 images and would like to resize only the horizontal ones.
> How could I do this with ImageMagick -resize option? Example:
>
> image01.jpg (width: 400, height: 200). This image (horizontal) will be
> resized to, let's say, 200x100.
>
> image02.jpg (width: 100, height: 500). This one is vertical, so it will not
> be affected.
>
> How could I do this?
>
> Thanks,
> Andre
> --
> View this message in context:
> http://www.nabble.com/Imagemagick-converting-horizontal-images-tf3272658.ht
>ml#a9099612 Sent from the ubuntu-users mailing list archive at Nabble.com.







More information about the ubuntu-users mailing list