Skip to content

Creating a lot of thumbnails with Shell script

This script create a thumbnail with width 100 of each png file in the actual directory.

for i in *.png
	echo "convert -thumbnail 100 $i $i"
	convert -thumbnail 100 $i $i
Published inenglish


  1. A little hint: if you are using wp_get_attachment_image_src() ftuncion with size and want to get exact thumbnail size: use thumbnail name given in definition (function add_image_size()). If you use array with dimensions WP will use first image size that have proper width or height. So you may get wrong image. Example: instead of 156×98 you might have got 120×98 if you have 2 images defined: 156×98 & 120×98 (height is the same). I fell for it once 😉 Oct 16 ’11 at 15:15

Leave a Reply

Your email address will not be published. Required fields are marked *