<?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>richardjdare.com &#187; photoshop scripting</title>
	<atom:link href="http://richardjdare.com/blog/tag/photoshop-scripting/feed/" rel="self" type="application/rss+xml" />
	<link>http://richardjdare.com</link>
	<description>Games, Ideas, Imagination</description>
	<lastBuildDate>Thu, 06 Apr 2023 12:02:17 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.2.38</generator>
	<item>
		<title>Toxin &#8211; Advanced Sprite Techniques</title>
		<link>http://richardjdare.com/blog/2013/03/toxin-advanced-sprite-techniques/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=toxin-advanced-sprite-techniques</link>
		<comments>http://richardjdare.com/blog/2013/03/toxin-advanced-sprite-techniques/#comments</comments>
		<pubDate>Sun, 24 Mar 2013 15:09:50 +0000</pubDate>
		<dc:creator><![CDATA[Richard Dare]]></dc:creator>
				<category><![CDATA[game development]]></category>
		<category><![CDATA[photoshop]]></category>
		<category><![CDATA[Toxin]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[photoshop scripting]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[sprites]]></category>

		<guid isPermaLink="false">http://richardjdare.com/blog/?p=955</guid>
		<description><![CDATA[Creating good looking graphics for an abstract game like Toxin is harder than it first appears. Not only are your images stripped bare of most signifying.]]></description>
				<content:encoded><![CDATA[<p dir="ltr"><img class="aligncenter size-full wp-image-959" style="border: 0px;" alt="toxin-sprites" src="http://richardjdare.com/blog/wp-content/uploads/2013/03/toxin-sprites.jpg" width="500" height="272" /></p>
<p dir="ltr">Creating good looking graphics for an abstract game like <a href="http://toxingame.com" target="_blank">Toxin</a> is harder than it first appears. Not only are your images stripped bare of most signifying information, requiring a real eye for the principles of graphic design, but creating the artwork itself – giving each line the right balance of sharpness and glow, demands careful image processing and a great deal of experimentation.</p>
<p>When I started making Toxin, the graphics were a real struggle. It took me an enormous amount of work to develop the look of the game. To give you an idea, I have a folder on my laptop with all of Toxin’s artwork in, and it weighs in at 967meg! All for a little mobile game!</p>
<p>Eventually all my experimentation began to pay off, and I developed some powerful techniques for creating animated multicoloured abstract sprites. In this post I want to describe one of my favourite methods.</p>
<p>I start by creating our sprite out of spline shapes in 3D Studio Max. Unlike many 3D programs, Max can render splines at various thicknesses, animate them, and can even apply texture maps and materials to them.</p>
<p>I then use gradient maps to mask out areas of the shapes that I want to be different colours. These gradient maps are then animated, so the different coloured areas can actually move around the shape.</p>
<p>Then, I do two sets of renders. First I render the shape with the masks on, so there’ll be a hole wherever the coloured area will be. Then I do another render with the mask inverted, so that only the coloured area is visible.</p>
<p><img class="aligncenter size-full wp-image-967" style="border: 0px;" alt="make-a-spiker" src="http://richardjdare.com/blog/wp-content/uploads/2013/03/make-a-spiker.jpg" width="500" height="380" /><br />
<em><span style="color: #808080; padding-bottom: 20px;">This diagram shows each step in the creation of one frame of animation for a Toxin sprite. The total animation is 64 frames long. This intricate process is largely automated using Photoshop scripts</span></em></p>
<p>Then its time to start up Photoshop. After deciding what colours I am going to use, I run each set of sprites through a Photoshop script that colourises them and adds a glow. To create the glow, I duplicate the image into another layer, Gaussian blur it, then additive-blend it on top. Sometimes I use several glow layers with different Gaussian blur parameters. I also find that using image-&gt;adjustments-&gt;Hue/Saturation to colourise gives me the best results.</p>
<p>The final step is to compose the two sets of colourised renders into a single sprite. I do this with another Photoshop script. The end result is a lot more interesting than the basic Geometry Wars style sprites everyone else is using, I think.</p>
]]></content:encoded>
			<wfw:commentRss>http://richardjdare.com/blog/2013/03/toxin-advanced-sprite-techniques/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Next Photoshop</title>
		<link>http://richardjdare.com/blog/2013/02/the-next-photoshop/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=the-next-photoshop</link>
		<comments>http://richardjdare.com/blog/2013/02/the-next-photoshop/#comments</comments>
		<pubDate>Sun, 24 Feb 2013 15:06:12 +0000</pubDate>
		<dc:creator><![CDATA[Richard Dare]]></dc:creator>
				<category><![CDATA[photoshop]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[photoshop scripting]]></category>
		<category><![CDATA[processing]]></category>

		<guid isPermaLink="false">http://richardjdare.com/blog/?p=905</guid>
		<description><![CDATA[If you’ve read this blog for very long you’ll know that I am a big fan of Photoshop scripting and procedural graphics. Toxin, the iPhone.]]></description>
				<content:encoded><![CDATA[<p>If you’ve read this blog for very long you’ll know that I am a big fan of Photoshop scripting and procedural graphics. <a href="http://toxingame.com" target="_blank">Toxin</a>, the iPhone game I’ve been <a href="http://richardjdare.com/blog/category/toxin/" target="_blank">working on</a>, uses procedural art and animated image processing effects extensively. I don’t think the game would be possible without Photoshop scripting.</p>
<p>However, Photoshop’s scripting system is far from perfect. You cannot access pixel data from within scripts, nor can you draw lines or circles or anything like that. These limitations have become really frustrating to me.</p>
<p>For example, on the day I started work on Toxin, I needed to draw an ellipse with precise dimensions. The whole game takes place inside an ellipse, you see. I couldn’t do it in Photoshop by clicking and dragging, it was too inaccurate, so I wrote a C program using the <a href="http://alleg.sourceforge.net/" target="_blank">Allegro</a> game library to create the precise shapes I needed. These were then loaded into Photoshop and used as guides while I created the game artwork.</p>
<p>Later I discovered <a href="http://processing.org/" target="_blank">Processing</a>, which is much quicker to develop in than C. I soon developed a workflow where I would go back and forth between Photoshop and Processing, generating procedural content then processing it or running it through scripts until I got the desired result.</p>
<p>Processing, however has some frustrating quirks of its own. As a simplified front end to Java, you often get Java errors that are incomprehensible without digging into the underlying platform. Also, it cannot effectively save semi-transparent PNGs which means that the anti-aliased sprites I was creating all had a solid background which had to be removed. I ended up redesigning my workflow and using the excellent Ghost and AntiGhost plugins from <a href="http://www.flamingpear.com/download.html" target="_blank">Flaming Pear</a> to overcome these problems.</p>
<h3>From graphics app to graphics platform</h3>
<p>All these issues got me thinking about what I really want from a high end graphics program. What I want is something like a programmable, graphical <a href="http://en.wikipedia.org/wiki/Lisp_machine" target="_blank">Lisp Machine</a>; a powerful graphics programming platform with the UI of an art application, not an art application with a bolted-on scripting system.</p>
<p>I want the ability to programmatically control every aspect of Photoshop from both external scripts and from a real-time <a href="http://en.wikipedia.org/wiki/Read–eval–print_loop" target="_blank">REPL</a> inside Photoshop that works like the command line used in some CAD programs.</p>
<p>I want to be able to type<em> line(10,10,100,100)</em> and have a line appear on my presently selected image. I want to be able to open the REPL and assign my current selection to a variable which I can later re-select with a simple command. I want to be able to access the pixel data in my images, and write my own filters in Javascript within the scripting system itself. I think anyone in high-end graphics or scientific imaging would love something like this.</p>
<p>A true graphics platform like I have described would likely have to be written from the ground up with programmability built in. Nevertheless I did spend some time finding out how far I could go with Photoshop&#8217;s native capabilities.</p>
<p>I had the idea of writing a Photoshop plugin that contained a number of drawing functions which could be called from scripts via a Javascript library that integrates with the Photoshop document model. So you could write <em>PSDraw.line(10,10,100,100);</em> in ExtendScript Toolkit, and my Javascript library would construct a call to the plugin which would draw the line.</p>
<p>Unfortunately, it&#8217;s not possible to get information from a plugin back to the Photoshop script thats running it, so it wouldn&#8217;t be possible to do a <em>getPixel()</em> or anything like that. At best, this plugin/script combo would give us a somewhat clunky way of drawing programmatically but little else that would justify the effort involved. (have you ever seen the <a href="http://www.mactech.com/articles/mactech/Vol.15/15.04/PhotoshopPlug-InsPart1/index.html" target="_blank">Photoshop plugin API?</a>)</p>
<p>As a secondary option I thought about actually embedding <a href="https://code.google.com/p/v8/" target="_blank">V8</a> inside a plugin which would contain an editor and debugger. Besides the ugliness of having 2 distinct Javascript engines running in the same app, the plugin architecture put paid to this idea. Photoshop plugins are one-shot operations. Load the plugin, set the parameters, perform the operation, then shutdown. My idea would only be effective if the plugin was a persistent part of the Photoshop environment.</p>
<p>So the only options then, would be for Adobe to integrate scripting more completely, or for someone else to start making what would be a true sucessor to Photoshop.</p>
<p>&nbsp;</p>
<p><figure class='media-wrapper player'><iframe width="500" height="375" src="http://www.youtube.com/embed/mOZqRJzE8xg?wmode=transparent" frameborder="0" allowfullscreen wmode="Opaque"></iframe></figure></p>
]]></content:encoded>
			<wfw:commentRss>http://richardjdare.com/blog/2013/02/the-next-photoshop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AtlasMaker 0.7 &#8211; Make Texture Atlases in Photoshop</title>
		<link>http://richardjdare.com/blog/2012/11/atlasmaker-0-7-make-texture-atlases-in-photoshop/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=atlasmaker-0-7-make-texture-atlases-in-photoshop</link>
		<comments>http://richardjdare.com/blog/2012/11/atlasmaker-0-7-make-texture-atlases-in-photoshop/#comments</comments>
		<pubDate>Sat, 24 Nov 2012 13:37:54 +0000</pubDate>
		<dc:creator><![CDATA[Richard Dare]]></dc:creator>
				<category><![CDATA[AtlasMaker]]></category>
		<category><![CDATA[game development]]></category>
		<category><![CDATA[photoshop]]></category>
		<category><![CDATA[photoshop scripting]]></category>
		<category><![CDATA[sprites]]></category>
		<category><![CDATA[texture atlas]]></category>
		<category><![CDATA[tiles]]></category>

		<guid isPermaLink="false">http://richardjdare.com/blog/?p=559</guid>
		<description><![CDATA[August 2016 Update: AtlasMaker is now on Github: https://github.com/richardjdare/Atlasmaker In game development it is common to have hundreds if not thousands of texture maps and animation.]]></description>
				<content:encoded><![CDATA[<p class="alert alert-info">August 2016 Update: AtlasMaker is now on Github: <a href="https://github.com/richardjdare/Atlasmaker" target="_blank">https://github.com/richardjdare/Atlasmaker</a></p>
<p>In game development it is common to have hundreds if not thousands of texture maps and animation frames in a single project. Keeping track of all these images is taxing for both the developer and the computer, so what we do is arrange the images into texture atlases.</p>
<p>A texture atlas is an image that contains many other images. Usually, all the animation frames for a single sprite, or all the textures for a single object are arranged into a single image. The game code then looks at a smaller portion of this image when it needs to draw a particular sprite or texture.</p>
<p><strong>AtlasMaker </strong>is a Photoshop script that lets you create these atlases inside Photoshop. It takes a directory of individual textures and arranges them on a single image. It can be used both for atlases of different sized images, and for tile grids which are commonly used in 2d games. <a href="http://richardjdare.com/blog/2009/08/texture-atlas-maker/">Earlier versions</a> of this script were released in 2009. I know I promised an update long ago, but I have been working on my iPhone game, <a href="http://toxingame.com" target="_blank">Toxin</a>. I have been using this script throughout <a href="http://richardjdare.com/blog/category/toxin/" target="_blank">Toxin&#8217;s development</a>, but never got round to tidying it up for public release.</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-564" style="border: 0px;" title="AtlasMaker main window" src="http://richardjdare.com/blog/wp-content/uploads/2012/11/atlasmaker07-1.jpg" alt="" width="500" height="438" /><br />
<em><span style="color: #808080;">AtlasMaker main window. A tile grid for a 2d game is being created</span></em></p>
<h3 style="text-align: left;">Features</h3>
<ul>
<li>Cross platform &#8211; tested in Photoshop CS3,CS4,CS5 on Windows and Mac OSX.</li>
<li>Open Source</li>
<li>Create texture atlases or tile grids for 2d games.</li>
<li>Several image sorting algorithms. Find the most efficient one for your textures.</li>
<li>Add a margin to each image.</li>
<li>Custom data file export.</li>
<li>Extendable &#8211; It&#8217;s easy to add your own rectangle packing algorithms and sorting methods.</li>
</ul>
<p><img class="aligncenter size-full wp-image-581" style="border: 0px;" title="Two atlases created with AtlasMaker" src="http://richardjdare.com/blog/wp-content/uploads/2012/11/test-atlases.jpg" alt="" width="510" height="311" /><br />
<em><span style="color: #808080;">Generated with AtlasMaker: Left, a texture atlas with variable sized images. Right, a tile grid. Images used are randomly generated test textures.</span></em></p>
<h3>Installing AtlasMaker</h3>
<p>There are two ways to running AtlasMaker in Photoshop.<br />
Unzip atlasmaker-v0.7.zip to your photoshop scripts folder. On windows this is usually: C:\Program Files\Adobe\yourphotoshopversion \Presets\Scripts<br />
On a Mac this folder is at: Applications/yourphotoshopversion/Presets/Scripts</p>
<p>When you next start Photoshop, AtlasMaker should appear in the File-&gt;Scripts menu.</p>
<p>Alternatively, you can run the script without installing by unzipping the atlasmaker folder somewhere, then selecting Scripts-&gt;Browse from the file menu and then selecting AtlasMaker.jsx.</p>
<h3>Quickstart guide</h3>
<p>The first thing to do is select a directory of images by clicking &#8220;browse&#8221; at the top of the window. Once you have done this, AtlasMaker will scan through the images and collect size information about them.</p>
<p>Next, you want to select your packing method. If your images are texture maps of different sizes then you want to select the &#8220;Atlas Maker&#8221;. If you are making a traditional 2d game where the sprites are all the same size, then you want to select the &#8220;Tile Grid&#8221;</p>
<p>You&#8217;ll notice that some text will appear underneath &#8220;Number of Files&#8221;. This is a notification from the Tile Grid Packer telling you how many rows and columns your images will take up given the default document size. Different packing methods provide different notification messages according to their nature.</p>
<p>Then you can optionally select a sorting method. Sorting the images in different ways can improve the efficiency of the texture atlas. Some packing methods do not allow sorting, and will disable this option if they are selected.</p>
<p>You can also add a margin here if you want a gap between your textures. Margins are added on to the width and height of each image just like CSS margins.<br />
Next, click &#8220;Document Settings&#8221; and you will be able to set the size of the texture atlas you are going to create. You can also set the document name here, and choose if you want to flatten all the layers into one, once the atlas is complete.</p>
<p>Now click &#8220;Create Atlas&#8221; and you&#8217;re done.</p>
<h3>Custom data file export</h3>
<p>One of AtlasMaker&#8217;s most powerful features is the custom data file export. You can export a text file for each texture atlas containing information about each image on the atlas. This might be XML or JSON to be loaded by a game engine, or you could use it to directly generate source code to be pasted into your application.</p>
<p><img class="aligncenter size-full wp-image-588" style="border: 0px;" title="AtlasMaker custom data file" src="http://richardjdare.com/blog/wp-content/uploads/2012/11/atlasmaker07-2.jpg" alt="" width="500" height="438" /><br />
<em><span style="color: #808080;">AtlasMaker custom data file panel. Here an XML fragment will be generated for each texture in the atlas. filenames and texture positions are substituted into the text using tags</span></em></p>
<p>Tags are used to substitute information about each image into the text:</p>
<ul>
<li><strong>#i</strong> &#8211; Image index (0.. number of images in directory)</li>
<li><strong>#filename</strong> – Filename of source image</li>
<li><strong>#width</strong> – image width</li>
<li><strong>#height</strong> – image height</li>
<li><strong>#x</strong> – X position of top left corner on atlas</li>
<li><strong>#y</strong> &#8211; Y position of top left corner on atlas</li>
<li><strong>#p</strong> – page number</li>
</ul>
<p>If you click the &#8220;Reorder export file&#8221; button, you can rearrange the order in which textures are listed in the export file. Just select filenames from the list and click &#8220;up&#8221; or &#8220;down&#8221; to reorder them. You can select multiple filenames by shift-clicking.</p>
<p>The zip file contains a readme.txt which describes every option in detail.</p>
<p>AtlasMaker is designed to be extensible. It is easy to add new packing methods and sorting algorithms. I have written the code to be more or less self explanatory in this regard, but if you want me to write something about it, please let me know.  And let me know if you find any bugs!</p>
<h3>Download the latest version of AtlasMaker from Github</h3>
<p><a class="btn btn-default" style="background-color: black;" href="https://github.com/richardjdare/Atlasmaker" target="_blank">Download from Github</a></p>
]]></content:encoded>
			<wfw:commentRss>http://richardjdare.com/blog/2012/11/atlasmaker-0-7-make-texture-atlases-in-photoshop/feed/</wfw:commentRss>
		<slash:comments>63</slash:comments>
		</item>
		<item>
		<title>SpriteGrabber &#8211; Photoshop Scripting for Game Development</title>
		<link>http://richardjdare.com/blog/2009/06/spritegrabber-photoshop-scripting-for-game-development/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=spritegrabber-photoshop-scripting-for-game-development</link>
		<comments>http://richardjdare.com/blog/2009/06/spritegrabber-photoshop-scripting-for-game-development/#comments</comments>
		<pubDate>Tue, 09 Jun 2009 20:53:16 +0000</pubDate>
		<dc:creator><![CDATA[Richard Dare]]></dc:creator>
				<category><![CDATA[game development]]></category>
		<category><![CDATA[photoshop]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[photoshop scripting]]></category>
		<category><![CDATA[sprites]]></category>

		<guid isPermaLink="false">http://richardjdare.com/blog/?p=25</guid>
		<description><![CDATA[One of the most common and tedious tasks in 2D game development is making sprite sheets from dozens or often hundreds of individual image files..]]></description>
				<content:encoded><![CDATA[<p>One of the most common and tedious tasks in 2D game development is making sprite sheets from dozens or often hundreds of individual image files. Back when I was making <a href="http://richardjdare.com/blog/games/">Starblaster</a>, I laid out several hundred sprites by hand. It took many, many hours and severely restricted my ability to experiment with different graphics. It&#8217;s even worse these days since most sprites use alpha channels; the semi-transparent images are almost impossible to line up by hand, and some particle effects are practically invisible unless they are laid on a dark background.</p>
<p>For my latest project (more info coming soon!) I decided I&#8217;d had enough of this drudgery, and wrote a Photoshop script to do the job for me.</p>
<p><img class="size-full wp-image-26 aligncenter" style="border-color: white;" title="spritegrabber01" src="http://richardjdare.com/blog/wp-content/uploads/2009/06/spritegrabber01.jpg" alt="SpriteGrabber v0.1" width="495" height="492" /></p>
<p>SpriteGrabber will take a directory full of image files and lay them out for you on one or more sprite sheets. Additionally, SpriteGrabber can export a text file containing information about each sprite. You can use this feature to generate calls to whatever function you use to load the sprites in your game.</p>
<h3>Instructions</h3>
<p>To run the script in Photoshop just go to File-&gt;Scripts-&gt;Browse and load the SpriteGrabber.jsx file from wherever you downloaded it to. It will run automatically and present you with the interface above.</p>
<p>Click &#8220;browse&#8221; and select the directory containing your sprites. SpriteGrabber will now process the directory and work out how many valid image files there are and how big the sprites are going to be. If you have different sized images in the directory, SpriteGrabber will use the largest dimensions to determine the sprite size.</p>
<p>Once the images are processed, the script will work out how many rows and columns there&#8217;ll be per page and how many pages will be needed to hold all the sprites. You can adjust the document width and height to alter these properties. Once you are happy, just click &#8220;Ok&#8221; to generate the sprite sheets.</p>
<h3>Datafile Export</h3>
<p>If you tick the &#8220;Enable datafile export&#8221; checkbox, SpriteGrabber will create a text file in the src directory called &#8220;SpriteInfo.txt&#8221;, containing a line of text for each sprite.</p>
<p>Each line is generated from the text entered into the &#8220;line template&#8221; edit box. Tags are used to substitute information about each sprite into the text.</p>
<p><strong>#i </strong>&#8211; Sprite index (0.. number of sprites in directory)</p>
<p><strong>#filename</strong> &#8211; Filename of source image</p>
<p><strong>#width</strong> &#8211; Sprite width</p>
<p><strong>#height</strong> &#8211; Sprite height</p>
<p><strong>#x</strong> &#8211; X position  of top left corner on spritesheet</p>
<p><strong>#y </strong>&#8211; Y position of top left corner on spritesheet</p>
<p>Lets say your game engine loads sprites like this: &#8220;SpriteManager-&gt;GetSprite(x,y,width,height);&#8221; and you have 300 sprites to load. You can generate all 300 calls by entering the following into the line template box:</p>
<p>SpriteManager-&gt;GetSprite(#x,#y,#width,#height);</p>
<p>SpriteGrabber will then generate 300 lines containing the correct coordinates and dimensions for each sprite. (This is probably a poor example as in real life you&#8217;d use a simple loop to do this, but it does illustrate how the feature works. The datafile export will come into its own when the next version is complete.)</p>
<h3>The Future</h3>
<p>SpriteGrabber is not intended as a masterclass in Photoshop scripting. In fact it&#8217;s the first script I&#8217;ve ever written, but it should help trim a few tedious hours off the development process. Soon I hope to have a new version ready that will be able to efficiently arrange sprites or textures of any size.</p>
<h3>Download</h3>
<p>SpriteGrabber has been tested on Photoshop CS2,CS4,CS5 for Windows Vista, and CS3,CS5 for Mac OS X.</p>
<h3><a href="http://richardjdare.com/files/spritegrabber-v0.5.zip" target="_blank"><img class="alignnone size-full wp-image-27" title="download" src="http://richardjdare.com/blog/wp-content/uploads/2009/06/download.png" alt="" width="160" height="45" /></a></h3>
]]></content:encoded>
			<wfw:commentRss>http://richardjdare.com/blog/2009/06/spritegrabber-photoshop-scripting-for-game-development/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
