Wednesday, January 13, 2010

Wiki world

As part of my foray into the wiki world of common good, I've written a small, but effective little script for automating conversion and reduction of JPG format images to PNG images of a specific size, using a tool called ImageMagick:
#!/bin/sh
for img in `ls *.jpg`
do
baseimg=`echo $img | sed s/\.jpg/\.png/`
convert $img -resize '300x300>' $baseimg
done

Certainly not the most versatile piece of code (yet), but it was written in minutes and has saved me quite a bit of time so far. If/when the need arises I'll modify it (and post it here).

Enjoy!

- - - - - - - - - -
ImageMagick does a number of things:

No comments:

Post a Comment