Shell One-Liner : Thumbnail a Directory

Linux One Liners

Thumbnail a Directory

Here is a one liner to thumbnail all of the images in a directory:

 
Note: This requires Requires Imagemagik
 

What the script does & how to use it

  1. cd to the image directory that you wish to make thumbnails of. This is also the directory that the thumbnails will be placed.

  2. type in the script at the command line

  3. 125 is the width in pixels of the thumbnails (you can change the number for larger/smaller thumbnails).

  4. It makes “tn-(image name).png” and puts it in the directory.

  5. All of the original images remain the same.

  6. This also works with names with spaces in them.

You can make thumbnail images in minutes that would take hours to do in GIMP or other image manipulation programs.  The script is very flexible, 125 (the number of pixels in width) can be changed to whatever number you wish, you can output them to .png or most any other image format you wish. The script is also non-destructive as it keeps the originals the same. This one liner is great for doing image galleries online or locally.

For more code like this go to our one liner’s page.

How useful was this post?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 1

No votes so far! Be the first to rate this post.


Leave a Reply

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


Updated on December 02, 2021

Pixelated Dwarf