batch for transforming images

David Fletcher dave at thefletchers.net
Sat Sep 13 19:00:06 UTC 2008


On Saturday 13 Sep 2008, Peter Klaassen wrote:
> Is thre a GUI or terminal programm that can resize
> all the imgaes in a dir to for instance 800 pixels width

I wrote myself a script to do just this sort of job. See below - this one 
converts my png files to jpg files at 8x6 inches, 300dpi, for printing at 
Jessops. Works a treat. Modify as required. Enjoy, everybody!

#!/bin/bash

for pngname in $(ls --format=single-column *.png)
do
  pngnamecroplen=`expr ${#pngname} - 4`
  basename=${pngname:0:$pngnamecroplen}
  echo convert $pngname to $basename.jpg
  if convert -resize 2400x1800! -density 300 -quality 80 $pngname 
$basename.jpg
  then
    rm -f $pngname
  fi
done

Might need to use a text editor to put the convert line back together :-)

Dave


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.ubuntu.com/archives/kubuntu-users/attachments/20080913/923f4288/attachment.sig>


More information about the kubuntu-users mailing list