ALINK="#FF0000"> [ Prev ][ Table of Contents ][ Front Page ][ Talkback ][ FAQ ][ Next ]
LINUX GAZETTE
...making Linux just a little more fun!
My Guide To Digital Photography
By Rob Tougher

Contents

Introduction

Since its initial installation on my machine in 2000, Linux has fulfilled my computing needs. I use Linux for the following:

This article focuses on the last item, digital photography, and describes how I use Linux to store, manipulate, and share my digital photographs.

Storing Photographs

I store my photographs in two places: on my hard drive, which acts as short-term storage, and on CD-ROM, where the photographs are permanently stored. I keep the last few months of photographs on my machine so they can be recalled quickly, and I transfer the older ones to CD-ROM to free up space on my drive.

To download photographs from my camera to my computer, I use the USB Mass Storage Driver. This driver is part of the Linux kernel, and lets me mount my camera as a SCSI device. I then use the mv command to transfer the photographs to my hard disk. My session usually looks like the following:

prompt$ mount -n /dev/sdb1 /mnt/camera
prompt$ mv /mnt/camera/dcim/100msdcf/* /home/robt/docs/photographs/
prompt$ umount -n /mnt/camera

Pretty simple, right? I mount the camera, move the photographs to a directory on my hard disk, and then unmount the camera.

(The USB Mass Storage Driver works with only a few camera models. Mine is a Sony DSC-F707. Many other cameras such as the Canon PowerShot series are recognized by the Gphoto2 program. Some cameras don't work yet under Linux -- it all depends on the camera manufacturer giving us, the free software community, enough technical specifications that we can write a driver.)

When my hard disk becomes filled, I transfer the older photographs to CD-ROM. I accomplish this by placing a blank CD-ROM in my CD Writer and typing the following at a command prompt (see the CD Writing HOWTO for information on how to use your CD Writer):

prompt$ mkisofs -o cd_image /home/robt/docs/photographs
prompt$ cdrecord -v speed=4 dev=0,0,0 -data cd_image

This creates a cd image containing my photographs, and burns the image to a fresh CD-ROM.

Manipulating Photographs

In photography, composition deals with the placement of objects within the frame of the photograph. A photographer makes many important decisions when composing a photograph:

As a novice photographer, my composition skills are lacking. I usually include too much background in my photographs, and I am oblivious to the camera's numerous features.

I use the GIMP to salvage my poor photographs. GIMP stands for the GNU Image Manipulation Program - it is a full-featured image manipulation application, similar to Adobe's Photoshop. I use it to perform the following:

These are only a few of the GIMP's features, but they greatly improve the quality of my photographs. I look forward to learning more about the GIMP.

Sharing Photographs

I share my digital photographs with friends and family. I accomplish this by posting the photographs to a publicly-accessible web site. Before posting, however, I do the following:

I use two Python scripts to perform these operations automatically. The first is named generate_photographs. This script uses the convert command to create web-sized photographs and thumbnails (convert is part of the ImageMagick suite of tools. Definitely check them out). The following is the complete script:

#!/usr/bin/env python

import os

#
# Prints the call to
# stdout, and then sends it
# to the OS.
#
def system_call(s):
	print s
	os.system(s)


#
# Clear out the directories. "small"
# contains thumbnails, and "medium"
# contains web-sized photographs.
#
for d in ("small", "medium"):

	system_call("rm -rf " + d)
	system_call("mkdir " + d)



files = os.listdir("photographs")

for file in files:

	if file != ".directory":

		system_call("convert -resize 640x480 photographs/" + file + " medium/" + file)
		system_call("convert -resize 160x120 medium/" + file + " small/" + file)

The second script is named generate_html. It loops through the photographs, and creates the HTML needed to display them on a web page. The following is the script, trimmed to show the Python code only:

#!/usr/bin/env python

import os

#
# HTML-related stuff removed....
#
html = ""


files = os.listdir("photographs")
br = 0

for file in files:

	html += '<a href="medium/' + file + '">'
	html += '<img src="small/' + file + '"></img>\n'
	html += '</a>'

	if br:
		html += '<br>\n'
		br = 0
	else:
		br = 1

#
# HTML-related stuff removed....
#


f = open("index.php","w+b")
f.write(html)
f.close()

After running these two scripts, I post the files to my web site, and email the address to everyone.

Conclusion

In this article I described how I use Linux to store, manipulate, and share my digital photographs. Hopefully I explained my techniques clearly enough so that you can use them for your digital photography needs.

Rob Tougher

Rob is a C++ software engineer in the New York City area.
Copyright © 2002, Rob Tougher. Copying license http://www.linuxgazette.net/copying.html
Published in Issue 82 of Linux Gazette, September 2002

[ Prev ][ Table of Contents ][ Front Page ][ Talkback ][ FAQ ][ Next ]