Home arrow Journal arrow Script to convert multiple .jpg images into .png images
Script to convert multiple .jpg images into .png images PDF
Wednesday, 18 April 2012
If you want to convert multiple .jpg images into .png images using ImageMagick convert command line tool here is a small script to do that.

First you must install ImageMagick:

  cd /usr/ports/graphics/ImageMagick
  make install clean; rehash


Then edit and run the following script:

convert_images.sh
#!/bin/sh

files=`ls *jpg`

mkdir png

for i in $files
do
  echo "Processing: "$i
  j=`echo "$i" | cut -d"." -f1`
  echo "Output="$j".png"
  convert $i png/$j".png"
done


All .jpg images from current directory (where your convert script is located) will be converted to .png images that will be saved in png subdirectory.

Last Updated ( Wednesday, 18 April 2012 )
 
< Prev   Next >

Other BSD Systems

OpenBSD

Misc

Solaris

Polls

Best BSD firewall?