Showing posts with label bash. Show all posts
Showing posts with label bash. Show all posts

Friday, April 3, 2015

Sorting a Bunch of Images by Resolution

I'd collected a heap of desktop wallpaper images over the years, and wanted to sort them by resolution.

This is the best way I found to do it, using the identify command from the ImageMagick tools. Of course I had to tweak it a little bit for my own purposes, namely to capture .jpeg files as well a .jpg, and to copy the files rather than move.

Script I ended up using:

#!/bin/bash for image in ./*.{jpg,jpeg} ; do res=$(identify -format %wx%h\\n $image); mkdir -p $res; cp -p $image $res; done

Monday, November 14, 2011

Bash Shell Case Insensitive

The very first thing to do on a fresh Linux install: make bash shell tab-completion case-insensitive.

Edit /etc/inputrc and add the following line:
set completion-ignore-case on
(As per the instructions at this Cyberciti FAQ)