old-www/LDP/LG/issue82/tougher.html

349 lines
10 KiB
HTML

<!--startcut ==============================================-->
<!-- *** BEGIN HTML header *** -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML><HEAD>
<title>My Guide To Digital Photography LG #82</title>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#0000AF"
ALINK="#FF0000">
<!-- *** END HTML header *** -->
<!-- *** BEGIN navbar *** -->
<IMG ALT="" SRC="../gx/navbar/left.jpg" WIDTH="14" HEIGHT="45" BORDER="0" ALIGN="bottom"><A HREF="shekhar.html"><IMG ALT="[ Prev ]" SRC="../gx/navbar/prev.jpg" WIDTH="16" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="index.html"><IMG ALT="[ Table of Contents ]" SRC="../gx/navbar/toc.jpg" WIDTH="220" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../index.html"><IMG ALT="[ Front Page ]" SRC="../gx/navbar/frontpage.jpg" WIDTH="137" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="http://www.linuxgazette.com/cgi-bin/talkback/all.py?site=LG&article=http://www.linuxgazette.com/issue82/tougher.html"><IMG ALT="[ Talkback ]" SRC="../gx/navbar/talkback.jpg" WIDTH="121" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../lg_faq.html"><IMG ALT="[ FAQ ]" SRC="./../gx/navbar/faq.jpg"WIDTH="62" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="veerapen.html"><IMG ALT="[ Next ]" SRC="../gx/navbar/next.jpg" WIDTH="15" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><IMG ALT="" SRC="../gx/navbar/right.jpg" WIDTH="15" HEIGHT="45" ALIGN="bottom">
<!-- *** END navbar *** -->
<!--endcut ============================================================-->
<TABLE BORDER><TR><TD WIDTH="200">
<A HREF="http://www.linuxgazette.com/">
<IMG ALT="LINUX GAZETTE" SRC="../gx/2002/lglogo_200x41.png"
WIDTH="200" HEIGHT="41" border="0"></A>
<BR CLEAR="all">
<SMALL>...<I>making Linux just a little more fun!</I></SMALL>
</TD><TD WIDTH="380">
<center>
<BIG><BIG><STRONG><FONT COLOR="maroon">My Guide To Digital Photography</FONT></STRONG></BIG></BIG><BR>
<STRONG>By <A HREF="mailto:robt@robtougher.com">Rob Tougher</A></STRONG></BIG>
</TD></TR>
</TABLE>
<P>
<!-- END header -->
<h3>Contents</h3>
<ul>
<li><a href=#1>Introduction</a>
<li><a href=#2>Storing Photographs</a>
<li><a href=#3>Manipulating Photographs</a>
<li><a href=#4>Sharing Photographs</a>
<li><a href=#5>Conclusion</a>
</ul>
<a name=1></a>
<h3>Introduction</h3>
<p>
Since its initial installation on my machine in 2000, Linux
has fulfilled my computing needs.
I use Linux for the following:
</p>
<ul>
<li>web browsing and email
<li>software development
<li>writing articles
<li>web site hosting
<li>digital photography
</ul>
<p>
This article focuses on the last item, digital photography, and
describes how I use Linux to store,
manipulate, and share my digital photographs.
</p>
<a name=2></a>
<h3>Storing Photographs</h3>
<p>
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.
</p>
<p>
To download photographs from my camera to my computer, I use
the <b><a href="http://www.linux-usb.org/">USB Mass Storage Driver</a></b>.
This driver is part of the Linux kernel, and
lets me mount my camera as a SCSI device. I then use the
<b>mv</b> command to transfer the photographs to my
hard disk. My session usually looks like the following:
</p>
<pre>
prompt$ mount -n /dev/sdb1 /mnt/camera
prompt$ mv /mnt/camera/dcim/100msdcf/* /home/robt/docs/photographs/
prompt$ umount -n /mnt/camera
</pre>
<p>
Pretty simple, right? I mount the camera, move the photographs to
a directory on my hard disk, and then unmount the camera.
</p>
<p>
(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 <A HREF="http://www.gphoto.org/">Gphoto2</A> 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.)
</p>
<p>
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
<b><a href="http://www.tldp.org/HOWTO/CD-Writing-HOWTO.html">
CD Writing HOWTO</a></b> for information on how to use your
CD Writer):
</p>
<pre>
prompt$ mkisofs -o cd_image /home/robt/docs/photographs
prompt$ cdrecord -v speed=4 dev=0,0,0 -data cd_image
</pre>
<p>
This creates a cd image containing my photographs, and
burns the image to a fresh CD-ROM.
</p>
<a name=3></a>
<h3>Manipulating Photographs</h3>
<p>
In photography, <i>composition</i> deals with the placement of objects
within the frame of the photograph. A photographer makes many important
decisions when composing a photograph:
</p>
<ul>
<li>Should I include X in the photograph?
<li>Should I shoot this horizontally, or vertically?
<li>How much depth-of-field should there be?
</ul>
<p>
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.
</p>
<p>
I use the <b><a href="http://www.gimp.org/">GIMP</a></b>
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:
</p>
<ul>
<li>crop photographs that are not composed correctly
<li>change the saturation of colors in photographs
<li>sharpen photographs that are blurry
</ul>
<p>
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.
</p>
<a name=4></a>
<h3>Sharing Photographs</h3>
<p>
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:
</p>
<ul>
<li>resize the photographs to a suitable web size
<li>create thumbnails of the photographs
<li>generate the HTML needed to display the photographs on a web page
</ul>
<p>
I use two
<b><a href="http://www.python.org">Python</a></b> scripts to perform these
operations automatically.
The first is named
<a href="misc/tougher/generate_photographs.py.txt">generate_photographs</a>.
This script uses the
<b>convert</b> command to
create web-sized photographs and thumbnails (<b>convert</b> is part of
the <b><a href="http://www.imagemagick.org/">ImageMagick</a></b>
suite of tools. Definitely check them out). The following
is the complete script:
</p>
<pre>
#!/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)
</pre>
<p>
The second script is named
<a href="misc/tougher/generate_html.py.txt">generate_html</a>.
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:
</p>
<pre>
#!/usr/bin/env python
import os
#
# HTML-related stuff removed....
#
html = ""
files = os.listdir("photographs")
br = 0
for file in files:
html += '&lt;a href="medium/' + file + '"&gt;'
html += '&lt;img src="small/' + file + '"&gt;&lt;/img&gt;\n'
html += '&lt;/a&gt;'
if br:
html += '&lt;br&gt;\n'
br = 0
else:
br = 1
#
# HTML-related stuff removed....
#
f = open("index.php","w+b")
f.write(html)
f.close()
</pre>
<p>
After running these two scripts, I post the files
to my web site, and email the address to everyone.
</p>
<a name=5></a>
<h3>Conclusion</h3>
<p>
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.
</p>
<!-- *** BEGIN bio *** -->
<P>
<H4><IMG ALIGN=BOTTOM ALT="" SRC="../gx/note.gif">Rob Tougher</H4>
<EM>Rob is a C++ software engineer in the New York City area.</EM>
<!-- *** END bio *** -->
<!-- *** BEGIN copyright *** -->
<hr>
<CENTER><SMALL><STRONG>
Copyright &copy; 2002, Rob Tougher.
Copying license <A HREF="../copying.html">http://www.linuxgazette.com/copying.html</A><BR>
Published in Issue 82 of <i>Linux Gazette</i>, September 2002</H5>
</STRONG></SMALL></CENTER>
<!-- *** END copyright *** -->
<HR>
<!--startcut ==========================================================-->
<CENTER>
<!-- *** BEGIN navbar *** -->
<IMG ALT="" SRC="../gx/navbar/left.jpg" WIDTH="14" HEIGHT="45" BORDER="0" ALIGN="bottom"><A HREF="shekhar.html"><IMG ALT="[ Prev ]" SRC="../gx/navbar/prev.jpg" WIDTH="16" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="index.html"><IMG ALT="[ Table of Contents ]" SRC="../gx/navbar/toc.jpg" WIDTH="220" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../index.html"><IMG ALT="[ Front Page ]" SRC="../gx/navbar/frontpage.jpg" WIDTH="137" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="http://www.linuxgazette.com/cgi-bin/talkback/all.py?site=LG&article=http://www.linuxgazette.com/issue82/tougher.html"><IMG ALT="[ Talkback ]" SRC="../gx/navbar/talkback.jpg" WIDTH="121" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><A HREF="../lg_faq.html"><IMG ALT="[ FAQ ]" SRC="./../gx/navbar/faq.jpg"WIDTH="62" HEIGHT="45" BORDER="0" ALIGN="bottom"></A><A HREF="veerapen.html"><IMG ALT="[ Next ]" SRC="../gx/navbar/next.jpg" WIDTH="15" HEIGHT="45" BORDER="0" ALIGN="bottom" ></A><IMG ALT="" SRC="../gx/navbar/right.jpg" WIDTH="15" HEIGHT="45" ALIGN="bottom">
<!-- *** END navbar *** -->
</CENTER>
</BODY></HTML>
<!--endcut ============================================================-->