<?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>Interactive Llama :: Interactive media tutorials and tips &#187; automation</title>
	<atom:link href="http://www.interactivellama.com/blog/archives/tag/automation/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.interactivellama.com/blog</link>
	<description>Interactive media tutorials and tips</description>
	<lastBuildDate>Thu, 22 Jul 2010 14:55:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>CSSsprite: Photoshop script combines two images for CSS hover</title>
		<link>http://www.interactivellama.com/blog/archives/photoshop-script-combine-two-images-css-hover-css-sprite/</link>
		<comments>http://www.interactivellama.com/blog/archives/photoshop-script-combine-two-images-css-hover-css-sprite/#comments</comments>
		<pubDate>Wed, 19 Nov 2008 20:48:41 +0000</pubDate>
		<dc:creator>Stephen James</dc:creator>
				<category><![CDATA[HTML and CSS]]></category>
		<category><![CDATA[Photoshop]]></category>
		<category><![CDATA[Productivity & Workflow]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[actions]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[sprite]]></category>
		<category><![CDATA[Workflow]]></category>

		<guid isPermaLink="false">http://www.smjdesign.com/designwell/?p=132</guid>
		<description><![CDATA[

The need

Professional web developers have been aware of CSS sprites or CSS rollovers/hovers since 2004 (The rollover term is taken JavaScript and hover term is taken from CSS).  They are the background graphics that change position based on mouse hover thus eliminating the need for JavaScript image swaps and image caching since the &#8220;mouse [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-medium wp-image-135" title="csssprites_before" src="http://www.smjdesign.com/designwell/wp-content/uploads/2008/11/csssprites_before-300x123.jpg" alt="" width="300" height="123" /></p>
<p><img class="alignnone size-medium wp-image-136" title="csssprites_after" src="http://www.smjdesign.com/designwell/wp-content/uploads/2008/11/csssprites_after-300x132.jpg" alt="" width="300" height="132" /></p>
<p><strong>The need<br />
</strong></p>
<p>Professional web developers have been aware of <a href="http://www.alistapart.com/articles/sprites/">CSS sprites</a> or CSS rollovers/hovers since 2004 (The rollover term is taken JavaScript and hover term is taken from CSS).  They are the background graphics that change position based on mouse hover thus eliminating the need for JavaScript image swaps and image caching since the &#8220;mouse on&#8221; and &#8220;mouse off&#8221; are one image. I have been using sprites for years. It is a more tedious process than clicking Swap image on a DreamWeaver drop down menu, but it produces more accessible and more clean code. The most tedious part of creating CSS sprites for menu navigation is aligning the static (in-active) and hover (active) images. This script solves this problem by taking two images and merging them into one. I hope this increases your productivity and creates a more standards-compliant web.</p>
<p><span id="more-132"></span></p>
<p>There are <a href="http://spritegen.website-performance.org/">online CSS sprite generators</a> out there. My Photoshop script is not as remarkable as these 20 image sprites, but it’s much simpler, and you can assign a keyboard shortcut to it. Also, all my sites are designed in Illustrator which is a slightly different work flow than most. I find that Photoshop is an awful layout program.</p>
<p><a href="http://www.smjdesign.com/designwell/wp-content/uploads/2008/11/CSSsprite.jsx">Download CSSsprite.jsx</a></p>
<p><strong>Installation<br />
</strong></p>
<p>A JSX script is similar to a Photoshop plugin or an action, but are commands in Photoshop&#8217;s JavaScript based script interface. Download and copy this script within the Presets&gt;&gt;Scripts folder of your Photoshop application folder:</p>
<ul>
<li>OS-X: Macintosh HD/Applications/Adobe Photoshop CS3/Presets/Scripts/</li>
<li>Windows: Program Files/Photoshop CS/Presets/Scripts</li>
</ul>
<p>The Script will appear under File&gt;&gt;Scripts&gt;&gt;CSSsprite on the menu. You can assign a keyboard shortcut to this script. I prefer Control+Command+S. This shortcut fits well with the Save for Web shortcut, Command+Alt+Shift+S.</p>
<p><strong>Usage<br />
</strong></p>
<p>Open two files (and <em>only</em> two files) with the same height and width (if they are different sizes, the offset of your hover button state will not be half of the height). Select the non-hover background image, making it active&#8211;thus making the hover background image de-active. Run the script from the Scripts menu mentioned above. This will place the hover background image on the bottom of the sprite. This script does not support adding a third state to the sprite, but you could add a third <em>and</em> fourth state. To do this, first combine the third and fourth state, and then combine that image with the normal/hover sprite.</p>
<p><strong>For your information: States for this script</strong></p>
<p>The following is a list of Photoshop commands that are executed in this script:</p>
<ul>
<li>Convert Image Mode to RGB</li>
<li>Make horizontal guide at 100% of canvas height</li>
<li>Switch to inactive document (-1 in document array)</li>
<li>&#8220;Duplicate Layer. . .&#8221; Layer Menu via right click</li>
<li>Switch back to inactive document (+1 in document array)</li>
<li>Double canvas size vertically</li>
<li>Transform/Move top layer down (50% of canvas size)</li>
<li>Zoom In (twice)</li>
</ul>
<p><strong>Result<br />
</strong>This gives you a two-layered Photoshop file with second layer the CSS hover layer. Save the file as GIF, PNG, or JPEG using File&gt;&gt;Save for Web.</p>
<p><strong>Notes<br />
</strong>Adobe Photoshop JavaScript is the only cross-platform scripting language for Photoshop. <em>This script was only tested Photoshop CS3 Extended (Mac)</em>. Our firm does not use Photoshop for web layout&#8211;only for image manipulation. We use Illustrator for layout.</p>
<p>I would like to thank the creators of <a href="http://blogs.adobe.com/crawlspace/2006/05/installing_and_1.html">ScriptingListenerJS</a> and <a href="http://ps-scripts.cvs.sourceforge.net/viewvc/ps-scripts/xtools/xapps/">ActionToJavaScript</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.interactivellama.com/blog/archives/photoshop-script-combine-two-images-css-hover-css-sprite/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
