Script to change images to 300dpi TIFF format

When we prepare research paper, many journals require the resolution of images to be 300dpi.
Below is the script to change various image files to 300dpi TIFF format.

#!/bin/bash
#A script which converts various image file formats into 300 dpi TIFF format.
#Usage: dpi300tiff.sh filename
#Wild card can be used.</code>

if [ $# = 0 ]
then
  echo "Please specify the files you want to convert!"
  echo "Usage: dpi300tiff.sh filename"
  exit 1
fi

for image in "$@"
do
  if [ -f $image ]
  then
  convert -units PixelsPerInch $image -density 300 `echo $image | sed 's/\..*$/.tiff/'`
else
  echo "$image: No such file"
fi
done

コメントを残す

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください