Unsung Heroes, Part 1
One of the things that makes a series like the "SysAdmin's Corner" possible to begin with is the work of talented programmers the world over. Of course, I would like to take credit for my particular contribution (the writing of the articles themselves). Then there are publications like Linux Journal that provide such a forum. You, the readers, are of paramount importance (thank you ever so much). Still, without the programmers who plug away to bring greatness to Linux through their applications, we wouldn't be having this discussion. The reward for their hard work is sometimes nothing more than personal satisfaction, the pleasure of knowing they have made a contribution.
Some of those contributions are popular and glitzy, commanding a great deal of media attention. Others aren't so visible but nevertheless provide us with useful programs and tools that we can't imagine not having at our disposal. That's what I want to focus on in the next few columns--the unsung heroes and heroines of the Linux and Open Source world. Yes, I am going to showcase some of those tools, and it's audience participation time! If you've got a fave and you feel it hasn't gotten the exposure it deserves, then let me know about it at this e-mail address mailto:email@example.com. I'll take it out for a test drive, and if I like it, I'll write about it here. Oh, and if you want a public note of thanks, make sure you include your e-mail address.
Okay, since I brought this whole thing up, I'll start. One of the most useful and fun things I've purchased in the last few years is my digital camera. Specifically, this one is a Canon S10 but your toy of choice may be an entirely different brand altogether. A digital camera frees you to take as many pictures as your heart desires because you are never wasting film. Digital images and the world wide web go hand in hand since the images are stored as .jpg files. I particularly like how easy it is to transfer the images to my notebook. Since the camera uses a Compact Flash card to store its images, I purchased a Compact Flash PC card adaptor--a PCMCIA gizmo that lets me plug the memory module into my notebook's card slot. Then, I use a simple mount command to access the images:
mount -t msdos /dev/hde1 /mnt/camera
From the /mnt/camera mountpoint, I copy images into a directory on my notebook with the cp command--piece of cake. The next step is for me to create a web page where I can show off all the cool pictures I've taken for friends or family. Sure, I can spin HTML code, create little thumbnails with The GIMP and away I go. To speed things up just a bit, I could do all this at the command line with ImageMagick www.imagemagick.org. In all likelihood, you have ImageMagick already loaded on your system--it's a fantastic collection of graphic manipulation programs. For instance, the identify command will tell you a lot of things about an image.
$ identify img_1418.jpg img_1418.jpg JPEG 800x600 DirectClass 8-bit 152kb 0.1u 0:14pg
While my camera does 1600 x 1200 images as well, I tend to take most of my pictures at 800 x 600 as the identify command shows. To create a thumbnail, I use another part of the ImageMagick package, the mogrify command (I love that name) to generate a thumbnail. Let's work with the above example. On first pass, I copy the image to a thumbnail image name. Then I mogrify:
$ cp img_1418.jpg thumb_img_1418.jpg $ mogrify -geometry 200x150 thumb_img_1418.jpg
Voilà! We have a 200 x 150 pixel thumbnail representation of the image we started with. Want to see that thumbnail with a nice little red border and rotated 90 degrees? We can use mogrify for that too:
$ mogrify -border 15 -bordercolor Red -rotate 90 thumb_img_1418.jpg
Say you want to create a nice contact sheet with all your pictures, but you want them to be 150 pixels wide, with a 20 pixel gallery quality frame and 10 pixels separation around each image. This time the command is called montage.
montage -geometry 150+10+10 -frame 20 img_* mypics.jpg
The result of that command gives me something like the following image.
Since we can do HTML without much fuss, we are well on our way to creating a pretty cool web presentation for our pictures. However, setting up that little web slide show can be a tad time consuming even if you know how to do all these things. This is where today's hero comes into play.
iGal is a simple Perl script written by Eric Pop, and it certainly qualifies as a program I cannot do without. If you need to create a presentation of images in a hurry for your web site, for your family or for your company, then you should check out iGal at www.stanford.edu/~epop/igal/. iGal also makes use of the ImageMagick tools we talked about to do its work.
Installing this is child's play since iGal (which stands for Image GALlery generator), being a Perl script, is already source. Still, you can download an RPM or Debian package from their site, which will put the script and its documentation in all the right places. You also can extract the tarred and gzipped bundle and do a make install:
tar -xzvf igal-1.3.tar.gz cd igal-1.3 make install
To make your instant slide show, change directory to where you already have a collection of images, and type the following:
igal -xy 150
That's all there is to it. You don't even need the -xy 150 flag I added. What this will do is create an HTML slide show with a title page made up of thumbnails scaled to a maximum of 150 pixels along their longest dimension. In your directory, you'll find an index.html page, your original images, thumbnail versions of these (prefixed with .thumb_), and cross-linked HTML pages for each image. It should look something like the following image.
The only real editing that I wind up doing is changing the title of the index.html file. By default, the title for that page is "Index of pictures", and I tend to like something a bit more descriptive. If you would like to see the final product of such a slide show, check out www.transversions.com/wfc/ for moments from the 2001 World Fantasy Convention in Montréal, Québec.
When you run iGal, the default caption for the images is the image name itself. You can change that without editing all the images by running iGal with the -c option. This will generate a file called .captions. Lines in the file will appear something like this:
img_1282.jpg ---- img_1400.jpg ----
To create captions for your images, append the text you want to the image:
img_1282.jpg ---- A picture of me img_1400.jpg ---- Mixa on the stairs
Save the file, rerun iGal with the -c option again, and all your pages will have your selected captions. If you choose the -C option (upper case C), you will get your captions, but the image names are preserved. Note that you should then remove the .captions file first.
For the down and dirty of iGal, check out the accompanying documentation, but frankly, it's not much more complicated than this. I will leave you with one final modification you can make to your presentation. You might have noticed the classic film reel effect on the index page. For those who (for reasons unknown) don't like this effect, it can be turned off with the -r flag.
That wraps it up for the first part of this series. Next time around, I'll be checking in on our first reader-submitted unsung hero. Until next time, remember that unless we sing their praises, unsung heroes remain just that, unsung.
Marcel Gagné's new book, Linux System Administration; A User's Guide (ISBN 0-201-71934-7, Addison Wesley) is in stores now (including your favorite on-line vendor). A free excerpt is available on his web site at www.salmar.com/marcel/LSAbook/index.html.
- The Geek's Guide to the Coolest 2013 Holiday Gifts
- Readers' Choice Awards 2013
- Android Candy: Free, Family, Fun—Fantastic
- A Plexible Pi
- Sublime Text: One Editor to Rule Them All?
- Raspberry Pi: the Perfect Home Server
- RSS Feeds
- Linux Kernel News - November 2013
- Tech Tip: Really Simple HTTP Server with Python
- Linux Systems Administrator
- Use Amazon, increase Microsoft profits
3 hours 37 min ago
- Reply to comment | Linux Journal
4 hours 21 min ago
- Planet Security
15 hours 53 min ago
- "RasPlex Linux-based OS
23 hours 32 min ago
- Clarification; RasPlex is not
1 day 6 hours ago
- Clarification; RasPlex is not
1 day 6 hours ago
- Starting the conversation is the first step.
1 day 7 hours ago
1 day 9 hours ago
1 day 9 hours ago
- Nice but....
1 day 9 hours ago