The Pimp
The Pimp is a command line interface to the excellent Python Imaging Library (PIL), designed to make applying routine image manipulations such as resizing, rotating and format changing easy and efficient, whether the target is a single image or a large batch of them. Pimp stands for "Python Image Manipulation Program", a reference to the Gimp, the "GNU Image Manipulation Program", which is what most users of free Unix operating systems use for these sorts of tasks, even though it may be overkill for their purposes. Read the detailed description for more information.
Requirements
The Pimp depends essentially upon the Python Imaging Library and, of course, on Python.
License
The Pimp is distributed under a standard 3-clause BSD license. It's as free as software gets.
Download
Download the latest version of the Pimp, Pimp 1.0 (released June 24, 2007).
Detailed description
If you use a free Unix operating system, such as Linux of one of the BSDs, chances are you use a program called Gimp to do your image manipulations. There's nothing wrong with this! Indeed, if you're a graphic designer or some such, it's probably the best thing you can do, since Gimp supports all sorts of fancy, Photoshopesque image manipulation options.
However, if like me your image manipulation needs are a bit simpler (95% of the time I use the Gimp, it's to do something like resize a wallpaper or rotate a photo taken with the camera held sideways) then using Gimp is overkill. You don't even need to see the image files in question to do these sorts of manipulations, and installing and updating the Gimp and all its associated libraries wastes your bandwidth, disk space, memory and time and introduces unnecessary security risks.
Instead, you should do your image manipulation from the command line, which makes things faster, lighter and more productive. For instance, you can resize an entire directory of photos with a single command instead of hours of point, click, point, click, point, click, click, bloody click pancakes!
The Pimp lets you do this. With it, you can:
- Resize images
- Rotate images in integer multiples of 90 degrees
- Change images between common formats (jpg, gif, png, bmp)
Here are some examples, to give you a feel for how Pimp works:
- Resize all images in the current directory whose names end in "jpg" to 640x480, saving the results as new files with "_small" on the end (so that "photo42.jpg" becomes "photo42_small.jpg", etc):
# pimp -x 640 -y 480 -s _small *.jpg
- Convert all of the .gifs in the current directory into .pngs:
# pimp -f png *.gif
Complete Instructions
The available options are:
-d directory
Save the manipulated images in the specified directory.-f format
Save the manipulated images in the specified format. format may be: jpg, gif, png, bmp-h
Print help.-i
Enable ``intelligent resizing''. With this switched on, images will always be resized in a way which preserves their aspect ratio, e.g. if the resizing options -x 300 -y 200 are specified then images which are wider than they are tall will become 300 pixels wide and 200 pixels tall, whereas images which are taller than they are wide will become 200 pixels wide and 300 pixels tall. This is handy for making thumbnails of a directory of images where not every image is portrait or landscape-n name
Save the manipulated image with the specified filename. Only works if a single image is being manipulated.-o
Overwrite original image files with the manipulated image. Use with caution!-p prefix
Name the manipulated image by putting prefix in front of its original name, e.g. use -p new_ to give the manipulated "photo42.jpg" the name "new_photo42.jpg". You may also (or instead) use -s to add a suffix on the end of the original name. If neither -p or -s are provided, Pimp will act as if -p _pimped were provided, so that "photo42.jpg" becomes "photo42_pimped.jpg".-r turns
Rotate the image 90 degrees clockwise turns times. For anti-clockwise rotations, use a negative integer. For example, rotate an image 90 degrees clockwise with "-r 1" or 90 degrees anti-clockwise with "r -1". A 180 degree rotation can be done using either "-r 2" or "-r -2". Note that if a command asks for a rotation and a resizing (using -x, -y), then the resizing is done first (as this is faster).-s suffix
Name the manipulated image by putting "suffix" at the end of its original name, e.g. use "-s _new" to give the manipulated "photo42.jpg" the name "photo42_new.jpg". You may also (or instead) use -p to add a prefix on the end of the original name. If neither -p or -s are provided, Pimp will act as if "-p _pimped" were provided, so that "photo42.jpg" becomes "photo42_pimped.jpg".-v
Print Pimp version number.-x width
Resize the image to be width pixels wide. If a height is not specified with -y, then the image's original aspect ratio will be preserverd.-y height
Resize the image to be height pixels wide. If a width is not specified with -x, then the image's original aspect ratio will be preserverd.