Tomi Kajala
Web designer

Sat 7/9/22 3:58 AM | Tomi

Renaming Photos Using Jhead

This reads the date and time from the EXIF record and renames the photo accordingly:

jhead -n%Y-%m-%d---%H.%M.%S photo.jpg

An example of the resulting filename: 2021-11-22---20.00.00.jpg (photo taken on 2021-11-22 at 8 pm).

If all photos in a directory are renamed in this fashion, most programs and directory listings will automatically show the photos in the order they were taken, because the alphabetical order of filenames now matches the chronological order.

Wed 7/6/22 5:57 AM | Tomi

Image Resizing Using Convert

To shrink an image so that the maximum width is 1200 and maximum height is 1200 but the image aspect is preserved:

convert pic.jpg -resize 1200x1200 pic-hd.jpg

To shrink an image "in place" (original image is lost):

convert pic.jpg -resize 1200x1200 pic.jpg

We can extend this to shrink all images in the current directory (it's a good idea to make a backup of the original images first):

for i in *jpg; do echo $i; convert $i -resize 1200x1200 $i; done
Click anywhere to close