<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Morris &#34;Mojo&#34; Jones &#187; photos</title>
	<atom:link href="http://mojo.whiteoaks.com/tag/photos/feed/" rel="self" type="application/rss+xml" />
	<link>http://mojo.whiteoaks.com</link>
	<description>Code Monkey, Astronomer, Photographer, Bridge Player</description>
	<lastBuildDate>Mon, 31 Oct 2011 01:03:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Perfect wallpaper from digital photos using Linux and Netpbm</title>
		<link>http://mojo.whiteoaks.com/2009/10/06/perfect-wallpaper-from-digital-photos-using-linux-and-netpbm/</link>
		<comments>http://mojo.whiteoaks.com/2009/10/06/perfect-wallpaper-from-digital-photos-using-linux-and-netpbm/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 04:13:15 +0000</pubDate>
		<dc:creator>Morris Jones</dc:creator>
				<category><![CDATA[Photography and Video]]></category>
		<category><![CDATA[Software and Systems]]></category>
		<category><![CDATA[digital photo processing]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[netpbm]]></category>
		<category><![CDATA[photos]]></category>
		<category><![CDATA[wallpaper]]></category>

		<guid isPermaLink="false">http://mojo.whiteoaks.com/?p=307</guid>
		<description><![CDATA[<p>The world is full of wallpaper managers for every operating system out there. I enjoy wallpapers taken from some of my digital photography, such as this trip to Yosemite last year.</p>
<p>On nice modern monitors, you can really enjoy the full resolution of your pictures. Jane and I just replaced our old Viewsonic CRT monitors with some [...]]]></description>
			<content:encoded><![CDATA[<p>The world is full of wallpaper managers for every operating system out there. I enjoy wallpapers taken from some of my digital photography, such as <a title="Yosemite photo album from 2008" href="http://photo.whiteoaks.com/2008-05-10-yosemite/saturday/index.html" target="_blank">this trip to Yosemite</a> last year.</p>
<p>On nice modern monitors, you can really enjoy the full resolution of your pictures. Jane and I just replaced our old Viewsonic CRT monitors with some nice Dell 23-inch LCD models.</p>
<p>Immediately I saw that I needed to regenerate our collection of wallpaper photos to match the aspect ratio and higher resolution of our new monitors. I admit to being a stickler for my wallpaper photo albums. I have these requirements:</p>
<ul>
<li>I want to scale and crop the photos to fill the screen exactly, no tiling or stretching.</li>
<li>I want no black bars, letterboxing, or distorted aspect ratios</li>
<li>I want to dim the maximum brightness of the photos so my desktop icons are still discernable</li>
</ul>
<p>My Canon 20D full-resolution pictures have more than enough pixels to fill the biggest screen, so I cobbled together a shell script some time ago using the PBM (Portable Bitmap) tools that have been around since probably the 80&#8242;s for manipulating images. I don&#8217;t think many of the Linux distros install the toolset by default, but they&#8217;re easily available. On Ubuntu or Debian you can install them with &#8220;apt-get install netpbm&#8221;.</p>
<p>I start by making a work directory (&#8220;wallpaper&#8221; in this instance) and a subdirectory to hold the full-resolution original images, named &#8220;full&#8221;. I collect copies of my full-resolution pictures there in ~/wallpaper/full.</p>
<p>Next I need to work out the transform. My original resolution images are 3504 pixels wide by 2336 pixels vertically. My monitor is 2048 pixels by 1152 pixels.</p>
<p>Rather than work out the math, I just scaled an original picture to the monitor width to see how tall it would be. This command pipeline would scale a picture to 2048 pixels wide:</p>
<pre>jpegtopnm full/IMG_1234.jpg | pnmscale -width 2048 | pnmtojpeg &gt;IMG_1234.jpg</pre>
<p>Opening that scaled image in Gimp told me that it was 2048 x 1365. That tells me that I need to crop some lines from the top and bottom of the image to fit them exactly to my monitor field. 1365 &#8211; 1152 leaves 213 lines to cut from the image. With the pbmtool &#8220;pamcut&#8221; I plan to cut 107 lines from the top of the image and give it a total height of 1152.</p>
<p>So I made this shell script to process all of the photos. The plan is to read all of the files from the &#8220;full&#8221; directory, and write perfectly scaled images to a subdirectory named &#8220;2048&#8243;. I&#8217;m also going to use the &#8220;ppmdim&#8221; utility to reduce the overall brightness of the images just a little. Here is the final script, called &#8220;mkwall2048&#8243;:</p>
<pre>for i in `ls -1 full`
do
echo $i
jpegtopnm full/$i \
 | pnmscale -width 2048 \
 | pamcut -top=107 -height=1152 \
 | ppmdim 0.8 \
 | pnmtojpeg &gt;2048/$i
done</pre>
<p>This loops through every file in the &#8220;full&#8221; directory, putting the filename in variable $i. The rest of the script is a pipeline that feeds the image through five different tools from the Portable Bitmap collection, as follows:</p>
<ol>
<li>jpegtopnm converts the input file to a portable &#8220;any&#8221; map, then feeds it to stdout</li>
<li>pnmscale scales the image to a width of 2048 pixels, preserving the aspect ratio</li>
<li>pamcut slices off the top 107 lines, and preserves the next 1152 lines of the image</li>
<li>ppmdim reduces the brightness of the image by 20% (80% of the existing brightness)</li>
<li>pnmtojpeg converts the portable bitmap image back to a JPEG file</li>
</ol>
<p>I&#8217;ve adjusted this script using the same process to make perfect wallpapers for my laptop monitors and desktops at work. It&#8217;s a real treat having a slideshow of my favorite photography available behind my work.</p>
]]></content:encoded>
			<wfw:commentRss>http://mojo.whiteoaks.com/2009/10/06/perfect-wallpaper-from-digital-photos-using-linux-and-netpbm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

