CUTCODEDOWN
Minimalist Semantic Markup

Welcome Guest
Please Login or Register

If you have registered but not recieved your activation e-mail in a reasonable amount of time, or have issues with using the registration form, please use our Contact Form for assistance. Include both your username and the e-mail you tried to register with.

Author Topic: Shell script: thumbnail generator using ImageMagick  (Read 682 times)

fgm

  • Jr. Member
  • **
  • Posts: 60
  • Karma: +5/-0
Shell script: thumbnail generator using ImageMagick
« on: 26 Nov 2019, 11:04:47 am »
This is the code I wrote some time ago to generate thumbnails for my static sites following Google recommendations. Full sized photos are 1200x800 and the miniatures are shown at 300x200, so I generate double sized thumbnails to be zoom-friendly as Jason recommends:
Code: [Select]
#!/bin/sh
cd /image/directory
for i in `find . -name "*jpg"`;
do
        echo $i;
        convert -resize 600x400 -sampling-factor 4:2:0 -strip -quality 80 -interlace JPEG -colorspace RGB $i -set filename:new '%t_thumb' %[filename:new].jpg;
done

This is the robots.txt entry to avoid getting the thumbnails indexed in Google:
Code: [Select]
User-agent: Googlebot-Image
Disallow: /images/*_thumb.jpg$

 

SMF spam blocked by CleanTalk

Advertisement