the ‘convert’ tool¶
Man page:http://www.ma.utexas.edu/cgi-bin/man-cgi?convert+1
(Lots) of examples: http://www.imagemagick.org/Usage/
Low level UNIX command line utility which is part of the ImageMagick graphics suite for messing around with images. It can do all kinds of fancy stuff , but the most useful one for Indymedia is probably batch resizing of images and reducing their disk size.
convert _image_filename_ -resize _dimension_ -quality _quality_% _output_filename_
e.g. to resize the file ‘46890.jpg’ so that its largest dimension is 650 px at 80% compression/quality and output to ‘46890_new.jpg’ invoke
convert 46890.jpg -resize 650x650 -quality 80% 46890_new.jpg
exiftool¶
Homepage: http://www.sno.phy.queensu.ca/~phil/exiftool/
Command line utility written in Perl (so theoretically cross platform) which can be used to strip meta data from most AV files. To strip all meta-data from a file invoke
exiftool -all= _filename_
To strip all previous meta data and add the comment “Produced by Indymedia Birmingham collective” to ‘protest.avi’ invoke
exiftool -all= -comment='Produced by Indymedia Birmingham collective' protest.avi
A script for resizing files and stripping meta data in a folder¶
The following (quite hacky) bash script will find all image files with .png,.jpg,and .gif extensions and resize them to the second argument passed to the script and place them in a folder given by the first argument of the script.
#!/bin/bash
mkdir $1
find . -name \*jpg -printf %f\\n -or -name \*png -printf %f\\n -or -name \*gif -printf %f\\n >image_list
number=`wc -l <image_list|awk '{print $1}'`
for((i=1;i<=$number;i++)) do
image=`awk 'NR==j {print $1}' j=$i <image_list`
echo $image
convert $image -resize $2 -quality 80% $1/$image
exiftool -all= ${1}/$image
done
rm image_list