Monthly Archives: April 2014
Mac OS X , shell script/GUI tool for batch image resize.

A friend of mine asked if it was possible.
the following script takes two inputs

1.master image file.

test.jpg <-or whatever your master image is.

2.a text file with the sizes listed in pairs:

<height in pixels> <width in pixel>

—Sample sizes.txt
120 120
130 130
400 400

Make sure that there is an empty line a the end of the file , only 1. more will give unwanted results..like I said error handling
will be done when I get to it.

 

usage: put the script and master image in a folder and run the script from the command.

$ ./transforms.sh
Enter the master image file name:
test.jpg
What is the filename with the sizes?:
sizes.txt
Changing test.jpg based on sizes.txt
[the script will output the transforms]
—————————–

notes:absolute no error handling yet. will do once I get around to it.

works on Mac os X and should work on other linux systems.

——————–actual source——————


#!/bin/sh
#this will resize images
Count=0
echo “Enter the master image file name:”
read masterfile
echo “What is the filename with the sizes?:”
read sizefile
echo “Changing $masterfile based on $sizefile”
while read line
do
echo “$line ”
((count++))
destfile=$count”_”$masterfile
echo “$destfile”
cp $masterfile $destfile
sips -z $line $destfile
done < “$sizefile”
 

 

Shell script with sample size file:
Download here.

—————————-

Simple GUI based version:
Usage:
–double click icon. (duhhh)
1.select master image
2.select text file with sizes.
3.select destination folder.

Download here.

—————————-

iOS icon generating size file :
usage:use with tools above.

Download here.

Posted on 2014年4月28日, 10:09 PM By
Categories: stuff