Archive for May, 2007

A Day Of Remembrance

28 May 2007

Instead of 30 May, we now observe it on the last Monday in May in order to get one more 3-day weekend into the calendar.

Some links to the history of Memorial Day here and here (caution signing their petition to restore the traditional date: the petition seems to be sponsored by some far-left group).

Thank you, all my fallen brothers and sisters. Whatever I do today, in the midst of family and friends and life, I will remember that I would not have any of it but for your sacrifice.


20070527_006a.jpg


Dr. Geeklove, or How I Learned To Stop Worrying And Love The CLI

19 May 2007

Since the rain we’ve had for the past few days has given my poor, elderly body a respite from the springtime demands of grounds maintenance, I decided to catch up on some geek stuff. I spent all of yesterday engaged in a titanic, life-or-death struggle with ImageMagick, a command-line image-manipulation program.

Well… maybe not life-or-death, since that would imply that one of the parties would not survive the encounter. And while I might have used a few bad words in the midst of yesterday’s struggle, I’d be very unhappy if ImageMagick died. The more I learn to use it, the more I learn to love it.

For those of you unfamiliar with the concept, the command-line interface (CLI) was all that was available before the Graphical User Interface (GUI) was popularized, first by Apple and then by Microsoft. This is a screen shot of a terminal (CLI) session on my computer:


shot_070519_0901.png

Where’s the mouse pointer?


Please note the dearth of pretty pictures and mouse-clickable items.

It may seem is definitely counter-intuitive to think that images may be manipulated from the CLI. I had trouble accepting the concept at first, but I’ve become more comfortable with it as I’ve become more experienced. Of course, this is all driven by my aversion to giving Microsoft any more of my money to allow me to temporarily access my intellectual property that I’ve created on my computer. I have a powerful motivation to learn this stuff.

Anyhoo (as I wipe the spittle from my monitor), what I wanted yesterday was a non-labor-intensive way to add a watermark to each image in a directory. For most open-source projects, there is a wealth of documentation. And most open-source documentation has been written by people with a limited grasp of the English language (be they native English-speakers or not) and/or a limited grasp of real-world applications of said projects and/or a limited grasp of what lesser and non geeks might be willing or able to understand. ImageMagick fares better than most in this regard, but the complexity and scope of the program makes the documentation difficult to wade through.

After beating my head against the wall of command-line tools, settings, options, operators and sequence operators, I stumbled across a link on ImageMagick’s home page to an online document titled “Examples of ImageMagick Usage”1. This document is itself large and complex, but it contains specific examples of command-line processing for a plethora of usages. Within the document, I found a link to Annotating Images, which held a section on Watermarking, which was just what I needed.

After I decided which method of watermarking I thought would work best for me, all I had to do was copy the commands in my terminal to produce the watermark “stamp.” That’s when the real fun started.

ImageMagick’s command-line tools, “composite” and “convert” (which takes “composite” as an image sequence operator), will only work for one image at a time. The command-line tool “mogrify,” which will apply itself to multiple images, will not take “composite” as an argument. I had run into an impenetrable wall.

But even if a wall is impenetrable, there’s usually a way over, under or around it.

Enter Bash scripting.

This is a geek’s tool I like so much that it’s almost embarrassing to stand up while I’m thinking about it. Bash scripts allow one to string together commands, test for conditions, execute commands and programs based on those tests, and lots of other stuff. They allow me to automate repetitive or complex tasks (such as cleaning out my log files and emailing me the results), or execute them simply from the command line (such as backing up my browser’s bookmarks or moving images from my digital camera to my hard drive).

I am not, however, an advanced scripter. It took me another few hours of struggling with for loops and string manipulation to finally come up with a solution.

I started at about 10 in the morning and spent about 8 hours total on this, when I subtract mealtimes, afternoon nap and goofing off. At 2201 last night, I executed my “watermark”2 script one more time. Within a few seconds all the images in the target directory had been watermarked.

Ta-daaa:


w_20070506_045.jpg

Skunk cabbage and fiddleheads in a Chappaqua, NY swamp.


I may change it later to tile the watermark, but the bulk of the work is done.

Okay, so it was a lotta work to get here. But now all I have to do is go to my CLI, navigate to the relevant directory, type the word “watermark” and hit “Enter.” I was gonna say that it was a bunch of pain up front for a bunch of ease later, but I had too much fun in the process to call it pain.


Footnotes:

1. While you’re at the “Examples” page, it’s worth a side trip to follow the link to Anthony’s Graphics Lab.

2. For those interested, here’s the “watermark” script:

#!/bin/bash

# This script adds a watermark to each image file in a directory.

for file in *

do
composite -gravity center -geometry +0+10 /home/cj/foto/worktable/stamp.png ${file} w_${file}
done

exit 0

Not much to show for all that work, is it? If you wanna use it, change the directory path to reflect your work environment. Don’t forget that you’re executing this script from the directory full of images you want to watermark. And if you wreck your images, it’s your own darn fault for taking advice from me.

Update at 070520/2023: Doh! I reinvented the wheel.

Batch Resizing Of Digital Images With IrfanView: A Tutorial

17 May 2007

Disclaimer: Use this tutorial at your own risk. It works fine for me, but I’m not responsible for any unfortunate results you may get.

Someone asked me how to resize multiple images with IrfanView. Instead of trying to explain it over the phone, long-distance, I decided to write it as a tutorial and post it here.

For those of you like me who need to perform batch processing of large numbers of digital images — but unlike me are still, sadly and inexplicably, paying the Clueless Tax to the pirates at Microsoft — IrfanView is an indispensible tool. While not open source, it’s free-as-in-beer and is capable of performing a multitude of operations on digital images, both individually and in batch. In this tutorial, I’ll try to explain the resizing functions.

Before I get started, make sure you have the latest version (4.00 as of this writing). If you don’t, or if you don’t have it at all, head on over to Irfan Skiljan’s site to download it and the plugins executable. While you’re there, you may want to throw some money his way in appreciation for the sweat he spent creating this nice program. Once you’ve got them, install them, IrfanView first and then the plugins. Downloading and installation of programs on Windoze are beyond the scope of this article; if you need help with them, dangle a bag of Cheezy Poofs in front of your favorite geek and beg for help. I’ll wait while you get squared away…

All set? Here we go.

The IrfanView installation should have left an icon on your desktop named “IrfanView Thumbnails” that has a cute picture of a Panda. Double-click to open. Navigate to the directory in which you’ve saved your images. You’ll be greeted by this screen (click on images to view full-size):

irfanview_select_thumbs.png

Select the images you wish to work on by LEFT-clicking on one and then holding down the Ctrl key while LEFT-clicking on the others. If you wish to work on all images in the directory, simply select one and then press Ctrl-A. Notice that the thumbnails and their names change color when selected.

RIGHT-click on any one of the selected thumbs and, from the popup menu, choose “Start batch dialog with selected files…”

irfanview_start_batch_dialog.png

At the “Batch conversion” screen, be sure to specify an output directory different from the one in which the original images reside. THIS IS IMPORTANT! If your original images are jpegs, and your output is jpegs, you risk the loss of your originals if you don’t use a different output directory.

irfanview_batch_dialog.png

You can choose a lot of different output formats, but for simplicity’s sake, choose “JPG – JPEG Format.” Click on the “Options” button just to familiarize yourself with the contents and then click OK, because the default values are fine.

irfanview_jpeg_options.png

Make sure the “Use advanced options” check box is checked, and click the “Set advanced options” button. You’ll see this screen:

irfanview_advanced_options.png

Check the “RESIZE” check box, select the “Set new size:” and “Set both sides to:” radio buttons. If you’re using Windoze’s default screen resolution of 800×600 pixels, or if you’re uploading to the intertubes, where most users accept that default, fill in the “Width:” box with the number 800 (if you wish to have the images fill the screen in higher resolutions, you can use 1024 for 1024×768 or 1280 for 1280×1024). You can leave the “Height:” box blank and choose the “pixels” radio button. Make sure the “Preserve aspect ratio (proportional)” check box is checked.

(Update at 070518/1109: I shouldn’t have to mention — but I probably do — that this process will give you some weird files unless all images are in horizontal format. Either resize before rotating the verticals, or do the resizing on horizontals and verticals separately. If you do them separately, for verticals use the “Height:” box instead of the “Width:” box, and fill it in with “600” or “768” or “1024” depending on your preferred output resolution.)

In the lower right quadrant of the screen, uncheck “Overwrite existing files.” Your screen should look like the screen shot here when you’re done. Click “OK.”

Back at the “Batch dialog” screen, click the “Start” button in the upper left. You’ll see a progress screen, which should look like this when it finishes:

irfanview_batch_conversion_done.png

Click “Exit.”

Since I find IrfanView to be kinda clunky for viewing images, at this point I open up ACDSee to view the results of the process.

irfanview_tutorial_result.png

What started out as 39.5 MB of .tif files ended up as 636 KB of .jpgs.

The Irfanview batch process also can rename, rotate and crop, as well as apply a number of other corrections and effects. Experiment. But only on copies of your images.

Note: Your screen decorations will differ from my screen shots. The computer on which I run IrfanView is the old Windoze98 box I built in 1999. I don’t use it for much of anything now except to walk people thru Windoze problems. IrfanView may also act differently in XP or Vista, I have no way of knowing.

Sod Off

17 May 2007

One of the outstanding characteristics of the Bronx is noise. I had a nice visit, but I was really looking forward to getting back to Maine’s relative quiet.

No such luck. While I was away, a major construction project was started across the street from my house. According to a friend, the turf at Memorial Field (of the nice, growing, sod kind) is being replaced by Astroturf.


20070516_003a.jpgThe rape of Memorial Field


Intellectually, I understand that this move will save the city money (despite its $1.1 million price tag), and will allow greater use of the field. But I spent too many years producing the kind of lawns that kids love to run on barefoot, and that high school athletes have played on forever — and this field was one I helped maintain many years ago — not to feel like I’m being stabbed in the heart every time I look across the street.

This is what grass is supposed to look like:


20070516_004a.jpgMy baby


Technically, I’m retired, but I’ve fought dandelions, crabgrass, grubs and ants to produce this. My lizard brain just doesn’t understand why anyone would throw it away for a plastic carpet.

Intermittently In Residence

6 May 2007

I was offline for most of yesterday. I thought that it was finally the senile dementia catching up with me, but after I pulled the PCMCIA card out of the lower slot and plugged it into the upper slot, my connectivity problems disappeared. That’s not to say that they won’t come back. I am here for now, though, and I hope to have more stuff up this evening.

In case I don’t get back, tho, here’s a place holder:

20050506_035.jpg

My filing and cataloging habits are so good that, while I know when and where I took this, I don’t have a clue as to what it is.

Friday (I Can’t Believe I’m Gonna Say This) Catblogging

4 May 2007

Yes. Look closely. This is probably the only time you’ll see cats on this blog.

I wanted to show someone my image editing workflow in Linux, and I can’t just throw the pictures out now that I got ’em.

Smokey, being eeeevil:

20070504_002a.jpg

Blogging Break

3 May 2007

For the regulars here (both of you), I’ll be on the road tomorrow morning. I’m not sure of what my internet access will be like, so I may not be posting again until Tuesday.

Okay, so that’s no different from my usual posting habits. Except this time I’m actually letting you know in advance.

It Doesn’t Rhyme With “Waco”

1 May 2007

I had to travel to the VA Clinic at Saco (pronounced SOCK-o) today, and the brain damage cleared away long enough for me to remember that Laurel Hill Cemetery on Beach Street is known for its masses of daffodils. This being daffodil season around these parts, I took the old Nikon and tripod with me and shot some more daffodils (as if you hadn’t had enough).

Lots of mommies pushing baby-filled strollers, some parking the kids in the middle of the flowers for cute photos. It was a nice cap to a task-filled day that had no space in it for my afternoon nap.

I wanted to post more pix out of this shoot, so I made ’em smaller. If they strain your eyes, lemme know and I’ll make ’em bigger and just take the account quota hit.


Path leading down to the Saco River, which at this point is a tidal estuary:

20070501_001a.jpg


There are lots of granite memorial benches, like this one:

20070501_002a.jpg


The daffodils come in several colors:

20070501_011a.jpg


These are nice:

20070501_020a.jpg


There’s even a bit of salt marsh. The wind wasn’t blowing especially hard, but it didn’t let up much. Because I was going for the depth of field, I was shooting at slow shutter speeds and had to time the shots for when the flowers were relatively still:

20070501_026a.jpg


This is the slope down to the river from the road where the less active people park and watch:

20070501_028a.jpg


I could swear that I heard little daffodil voices singing, “Neener, neener, neener” to the marble reminder of mortality in their midst:

20070501_029a.jpg


And here’s Captain Jack:

20070501_034a.jpg