|
I want to share this because I just discovered a really simple way to do something I've been doing more manually for a long time.
I take pictures with my camera at maximum resolution, which gives me great images that are way too big to put on places like Photobucket. To share the pics more easily with friends I've picked representative pics and resized them with Gimp, using some of its batch conversion techniques. That makes things quite a bit easier (some basic principle as batch conversions with Photoshop or the like), but sometimes, ya just want to do the whole folder with out a lot of click and dragging and selecting, or even just having to start up a resource hog to do one thing ... whatever.
Gimp is, among other things, a front-end for a lot of command line tools, one of which is, simply enough, called convert. It does a LOT of things. Well, one thing I figured out I could do with it is write a simple script and would resize every image in a given directory to my typical 1024x768, also maintaining aspect ratio, which means if 1024x768 would squeeze the pic and make it look weird, convert gets as close to that as possible. Now, I knew about "convert" already, but I didn't realize how simple the script would be, so I made this with a text editor:
#!/bin/bash mkdir resize for img in `ls *.JPG` do convert -size 1024x768 $img ./resize/$img done
I used the upper-case "JPG" because my camera adds extensions in upper-case.
Named that rsjpg.sh, put it in my ~/bin directory, made it executable, and now when I download a group of jpegs from my camera, I just cd to that directory, run this, and it creates a new directory with copies of all those pics, resized as I want them. Took less than 10 seconds just now to convert 61MB of images, not including transfer time from camera, and the resized files consume 14MB and are of a suitable size for uploading.
The script is a bit sloppy. I'll eventually make it check for the existence of the directory "resize" first, then expand it to look for .tif, .gif, .png, etc. and the upper-case equivalents. But, it was quick and dirty and does what I want quickly.
Just thought I'd share.
|