-3

I'm trying to resize and crop about 300,000 photos. I have written the following script, but it is not very fast (takes about 1 minute per 125 photos). Since I have 300k photos to work with... it will take 40 hours or so to run through them all. Yikes.

I don't expect the process to be -fast-, but is there anyway I can make it faster?

I am running Ubuntu 14.04 on a SONY VIAO with a Quad Core Intel i5 and 8GB RAM, if that helps.

#!/bin/bash  
start=`date +%s`

mkdir cropped

parallel --eta convert {} -resize 1920x1440 -crop 1920x1080+0+$1 cropped/{} ::: *.JPG

end=`date +%s`

runtime=$((end-start))
echo "Runtime is $runtime" 
Brian C
  • 1,333
  • 3
  • 19
  • 36

1 Answers1

1

If you have a recent version of ImageMagick, you can provide a hint to the JPEG decoder:

... convert {} -define jpeg:size=1920x1440 -resize 1920x1440 -crop 1920x1080+0+$1 cropped/{} ...

Older versions use the -size option for that purpose:

... convert {} -size 1920x1440 -resize 1920x1440 -crop 1920x1080+0+$1 cropped/{} ...

Sorry, I don't remember exactly when the syntax changed. Try the "-define" first.

Glenn Randers-Pehrson
  • 11,940
  • 3
  • 37
  • 61