<?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>Likesalmon.net &#187; Imagemagick</title>
	<atom:link href="http://likesalmon.net/tag/imagemagick/feed/" rel="self" type="application/rss+xml" />
	<link>http://likesalmon.net</link>
	<description>Web development for designers</description>
	<lastBuildDate>Sat, 21 Jan 2012 20:40:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Use Image Magick to batch convert .png files to .gif</title>
		<link>http://likesalmon.net/use-image-magick-to-batch-convert-png-files-to-gif/</link>
		<comments>http://likesalmon.net/use-image-magick-to-batch-convert-png-files-to-gif/#comments</comments>
		<pubDate>Sat, 16 Oct 2010 21:17:36 +0000</pubDate>
		<dc:creator>Ammon</dc:creator>
				<category><![CDATA[Solutions]]></category>
		<category><![CDATA[Imagemagick]]></category>

		<guid isPermaLink="false">http://likesalmon.net/?p=456</guid>
		<description><![CDATA[I just checked, and W3Counter puts global Internet Explorer 6 usage at just 5.78%. This is a pretty good argument for not supporting it anymore with my websites, but I still do it. Maybe its just habit, or maybe its because I&#8217;ve become really fast at dealing with IE6 and its many deficiencies so its [...]]]></description>
			<content:encoded><![CDATA[<p>I just checked, and <a href="http://www.w3counter.com/globalstats.php" title="Browser usage stats">W3Counter</a> puts global Internet Explorer 6 usage at just 5.78%.  This is a pretty good argument for not supporting it anymore with my websites, but I still do it.  Maybe its just habit, or maybe its because I&#8217;ve become really fast at dealing with IE6 and its many deficiencies so its just not that big a deal.</p>
<h2>Just ignore it</h2>
<p>One thing that sames me time is the way I handle .png files in IE6: I don&#8217;t.  IE6 can&#8217;t handle transparency in .png files, but instead of using a script to fix it (which has never really worked for me) I just copy all the pertinent css to a file called IE6.css, which I load via <a href="http://www.quirksmode.org/css/condcom.html" title="Quirksmode">conditional comments</a>.  I change all the image filenames to .gif like this:</p>
<h3>style.css</h3>
<p><code>#content {<br />
background: transparent url('images/background.<strong>png</strong>') repeat-y top left;<br />
}</code></p>
<h3>ie6.css</h3>
<p><code>#content {<br />
background: transparent url('images/background.<strong>gif</strong>') repeat-y top left;<br />
}</code></p>
<h2>The Magick</h2>
<p>Then I batch convert all my .png files with Image Magick and place them in a special folder, like this:</p>
<p><code>$ mkdir gifs</code><br />
<code>$ mogrify -path gifs/ -format gif *.png</code></p>
<p>The resulting gif files are much lower quality than the png&#8217;s, but at least IE6 users can see the site.  Besides, they&#8217;re used to the Internet looking like crap.</p>
]]></content:encoded>
			<wfw:commentRss>http://likesalmon.net/use-image-magick-to-batch-convert-png-files-to-gif/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Imagemagick: use montage to proof images</title>
		<link>http://likesalmon.net/imagemagick-use-montage-to-proof-images/</link>
		<comments>http://likesalmon.net/imagemagick-use-montage-to-proof-images/#comments</comments>
		<pubDate>Tue, 15 Jun 2010 03:51:47 +0000</pubDate>
		<dc:creator>Ammon</dc:creator>
				<category><![CDATA[Solutions]]></category>
		<category><![CDATA[Imagemagick]]></category>

		<guid isPermaLink="false">http://likesalmon.net/?p=359</guid>
		<description><![CDATA[The following command will create an image called montage.png that is a collection of all the .png files in the current directory. Images larger than 150px on a side will be resized, but aspect ratio is preserved. The images are separated by a 2px offset. $ montage *.png -geometry 150x150\>+2+2 montage.png]]></description>
			<content:encoded><![CDATA[<p>The following command will create an image called montage.png that is a collection of all the .png files in the current directory.  Images larger than 150px on a side will be resized, but aspect ratio is preserved.  The images are separated by a 2px offset.</p>
<p><code>$ montage *.png -geometry 150x150\>+2+2 montage.png</code></p>
]]></content:encoded>
			<wfw:commentRss>http://likesalmon.net/imagemagick-use-montage-to-proof-images/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tile images in Imagemagick to create CSS sprites</title>
		<link>http://likesalmon.net/tile-images-in-imagemagick-to-create-css-sprites/</link>
		<comments>http://likesalmon.net/tile-images-in-imagemagick-to-create-css-sprites/#comments</comments>
		<pubDate>Fri, 04 Jun 2010 05:31:35 +0000</pubDate>
		<dc:creator>Ammon</dc:creator>
				<category><![CDATA[Musings]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Imagemagick]]></category>

		<guid isPermaLink="false">http://likesalmon.net/?p=350</guid>
		<description><![CDATA[The Magick This will stack two images to create a CSS sprite. Very handy for flicker-free image rollovers: $ montage -background transparent -tile 1x2 -geometry +0+2 image1.gif image2.gif result.gif You could create a taller or wider stack by adjusting the -tile option. For example -tile 2x10 would stack 2 images across and 10 images down. [...]]]></description>
			<content:encoded><![CDATA[<h3>The Magick</h3>
<p>This will stack two images to create a CSS sprite.  Very handy for flicker-free image rollovers:</p>
<p><code>$ montage -background transparent -tile 1x2 -geometry +0+2 <em>image1.gif</em> <em>image2.gif</em> result.gif</code></p>
<p>You could create a taller or wider stack by adjusting the <code>-tile</code> option.  For example <code>-tile 2x10</code> would stack 2 images across and 10 images down.  If you don&#8217;t have 20 images, Imagemagick will leave empty spaces.</p>
<p>Not sure why I had to set <code>-geometry +0+2</code>.  That creates a 2 pixel vertical offset, which was necessary to align to two images.  If you leave it at <code>-geometry +0+0</code> the hover image is slightly off, which makes for a cool &#8220;pressed in&#8221; effect, but it&#8217;s not always what I need.</p>
<h3>The CSS</h3>
<p>The CSS you would use to make the rollover work would go something like this:</p>
<p><code><br />
a.rollover {<br />
background: url('Images/result.gif') no-repeat center top;<br />
display: block; /* necessary to set the width and height of a tags */<br />
text-indent: -99999px; /* get the link text out of the way if replaced by an image */<br />
overflow: hidden; /* so you don't get the dotted outline when you click on the link */<br />
width: 100px;<br />
height: 100px;<br />
}</p>
<p>a.rollover:hover {<br />
background: url('Images/result.gif') no-repeat center bottom;<br />
}<br />
</code></p>
<h3>Bash bonus!</h3>
<p>When I did this, I had a folder of images with the naming scheme <em>menu_img1.gif, menu_img1_on.gif, menu_img2.gif, menu_img2_on.gif.. .etc.</em>.  I automated the sprite creation process from the command line like this:</p>
<p><code><br />
$ array=( img1 img2 img3 )<br />
$ for i in 0 1 2<br />
$ do<br />
$ montage -background transparent -tile 1x2 -geometry +0+2 menu_${array[i]}.gif menu_${array[i]}_on.gif menu_${array[i]}_sprite.gif<br />
$ done</code></p>
]]></content:encoded>
			<wfw:commentRss>http://likesalmon.net/tile-images-in-imagemagick-to-create-css-sprites/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Image Magick: Resize a batch of images so they all come out square, and preserve filenames</title>
		<link>http://likesalmon.net/image-magick-resize-a-batch-of-images-so-they-all-come-out-square-and-preserve-filenames/</link>
		<comments>http://likesalmon.net/image-magick-resize-a-batch-of-images-so-they-all-come-out-square-and-preserve-filenames/#comments</comments>
		<pubDate>Thu, 22 Apr 2010 04:05:12 +0000</pubDate>
		<dc:creator>Ammon</dc:creator>
				<category><![CDATA[Solutions]]></category>
		<category><![CDATA[Imagemagick]]></category>

		<guid isPermaLink="false">http://likesalmon.net/?p=331</guid>
		<description><![CDATA[The following command will shrink all .jpg&#8217;s in the current directory that are larger than 500px and center them on a square 500x500px canvas. Since the aspect ratio of the original images will be preserved and not all of the originals are square, the left over space will be filled with an off-white color. All [...]]]></description>
			<content:encoded><![CDATA[<p>The following command will shrink all .jpg&#8217;s in the current directory that are larger than 500px and center them on a square 500x500px canvas.  Since the aspect ratio of the original images will be preserved and not all of the originals are square, the left over space will be filled with an off-white color.  All the modified images will be placed in a directory called &#8216;resized&#8217;.  Original filenames will be preserved.</p>
<p><code>mogrify -path resized -resize 500x500\> -background 'rgb(217,215,202)' -extent 500x500 -gravity center *.jpg</code></p>
]]></content:encoded>
			<wfw:commentRss>http://likesalmon.net/image-magick-resize-a-batch-of-images-so-they-all-come-out-square-and-preserve-filenames/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Image Magick: Resize a batch of images and preserve the original file names</title>
		<link>http://likesalmon.net/image-magick-resize-a-batch-of-images-and-preserve-the-original-file-names/</link>
		<comments>http://likesalmon.net/image-magick-resize-a-batch-of-images-and-preserve-the-original-file-names/#comments</comments>
		<pubDate>Thu, 22 Apr 2010 03:21:50 +0000</pubDate>
		<dc:creator>Ammon</dc:creator>
				<category><![CDATA[Solutions]]></category>
		<category><![CDATA[Imagemagick]]></category>

		<guid isPermaLink="false">http://likesalmon.net/?p=327</guid>
		<description><![CDATA[The following command will resize any and all .jpg&#8217;s in the current directory that are larger than 500px on either side and put them in a file called &#8216;resized&#8217;. Aspect ratios will be respected, and the same filenames will be used for the modified images. mogrify -path resized -resize 500&#62;x500\&#62; *.jpg Yes, you have to [...]]]></description>
			<content:encoded><![CDATA[<p>The following command will resize any and all .jpg&#8217;s in the current directory that are larger than 500px on either side and put them in a file called &#8216;resized&#8217;.  Aspect ratios will be respected, and the same filenames will be used for the modified images.</p>
<p><code>mogrify -path resized -resize 500&gt;x500\&gt; *.jpg</code></p>
<p>Yes, you have to use <code>mogrify</code> and not <code>convert</code> because only <code>mogrify</code> excepts the <code>-path</code> command.  And I&#8217;m pretty sure it&#8217;s important to escape the greater than symbols in the <code>-path</code> argument like I did.</p>
]]></content:encoded>
			<wfw:commentRss>http://likesalmon.net/image-magick-resize-a-batch-of-images-and-preserve-the-original-file-names/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

