Showing posts with label batch. Show all posts
Showing posts with label batch. Show all posts

21 Oct 2009

Batch renaming a group of photos

On Linux we can use jhead to batch rename a bunch of photos using many parameters, including EXIF information present on the files themselves.
Despite the fact that jhead is used to manipulate EXIF data it is as useful for renaming files.

First we need to install it:

sudo apt-get install jhead

Then we can choose from the many parameters which syntax best matches our needs.
In this short sample we'll just rename all the JPG files on a directory with a common prefix ( PIC_ ) and a sequential 4 digit number sorted by EXIF date if present or file date otherwise.

This can be achieved as follows:

jhead -nfPIC_%04i *.JPG

If we wanted to include EXIF date on the file name to get something like PIC_20091021-0164.jpg we could use:

jhead -nPIC_%y%m%d-%04i *.JPG

Of course there are many more options, check jhead's help for more info:

jhead -h

If needed you can also resize all those images at once using ImageMagick as explained on a previous post.

14 Jun 2008

Batch resize images using ImageMagick

Resizing images is a task I had to do several times through time and usually I use Gimp for the task, however, doing it for hundreds of different files would be very painful without some kind of batch process to do it.
That's why I use one of the many functionalities ImageMagick provides.

Those using Ubuntu (like I do) can install ImageMagick like this:
# sudo apt-get install imagemagick

So what I usually do when I want to resize a group of images to a specific size is move them together into the same directory and then:

# mogrify -resize 1024x768 *

This command just replaces all the images found with the resized ones. Note that it does not change the original aspect ratio so it's not guaranteed that you'll get 1024x768.
If you really want to convert the images to a specific size, regardless of it's aspect ratio then you just add a question mark to the previous command like this:

# mogrify -resize 1024x768! *