<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://scottholden.name/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Scott Holden's Personal Blog : Photoshop</title><link>http://scottholden.name/archive/tags/Photoshop/default.aspx</link><description>Tags: Photoshop</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.2)</generator><item><title>More photoshop automation (jscript this time!)</title><link>http://scottholden.name/archive/2004/05/11/more-photoshop-automation-jscript-this-time.aspx</link><pubDate>Tue, 11 May 2004 18:34:04 GMT</pubDate><guid isPermaLink="false">b9eea908-4a60-4fb4-8ee8-dc68b05b7b9a:23</guid><dc:creator>scottholden</dc:creator><slash:comments>0</slash:comments><comments>http://scottholden.name/comments/23.aspx</comments><wfw:commentRss>http://scottholden.name/commentrss.aspx?PostID=23</wfw:commentRss><description>&lt;p class="MsoNormal"&gt;&lt;font face="Verdana" color="#333300" size="1"&gt;&lt;span style="font-size:9pt;color:#333300;font-family:verdana;"&gt;So I am going wild on automating my processes for web site generation with regards to photos. I really want to make it easy for me to post photos now and for future.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoNormal"&gt;&lt;font face="Verdana" color="#333300" size="1"&gt;&lt;span style="font-size:9pt;color:#333300;font-family:verdana;"&gt;I have added a watermark to many of my photos! &lt;a href="http://www.airjockeys.com/galleries/action"&gt;http://www.airjockeys.com/galleries/action&lt;/a&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoNormal"&gt;&lt;font face="Verdana" color="#333300" size="1"&gt;&lt;span style="font-size:9pt;color:#333300;font-family:verdana;"&gt;The problem is that the watermark needs to be a range of colors for different pictures. So, I used Jscript to automate this process in &lt;span class="SpellE"&gt;photoshop&lt;/span&gt;. The steps:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-left:0.5in;text-indent:-0.25in;mso-list:l0 level1 lfo1;tab-stops:list .5in;"&gt;&lt;font face="Verdana" color="#333300" size="1"&gt;&lt;span style="font-size:9pt;color:#333300;font-family:verdana;mso-fareast-font-family:verdana;mso-bidi-font-family:verdana;"&gt;&lt;span style="mso-list:ignore;"&gt;1. &lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Verdana" color="#333300" size="1"&gt;&lt;span style="font-size:9pt;color:#333300;font-family:verdana;"&gt;I created my watermark with two different images: a black and a white version. Each image is a different layer in a PSD.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-left:0.5in;text-indent:-0.25in;mso-list:l0 level1 lfo1;tab-stops:list .5in;"&gt;&lt;font face="Verdana" color="#333300" size="1"&gt;&lt;span style="font-size:9pt;color:#333300;font-family:verdana;mso-fareast-font-family:verdana;mso-bidi-font-family:verdana;"&gt;&lt;span style="mso-list:ignore;"&gt;2. &lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Verdana" color="#333300" size="1"&gt;&lt;span style="font-size:9pt;color:#333300;font-family:verdana;"&gt;Assume that the current active image is the one to add the watermark to.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-left:0.5in;text-indent:-0.25in;mso-list:l0 level1 lfo1;tab-stops:list .5in;"&gt;&lt;font face="Verdana" color="#333300" size="1"&gt;&lt;span style="font-size:9pt;color:#333300;font-family:verdana;mso-fareast-font-family:verdana;mso-bidi-font-family:verdana;"&gt;&lt;span style="mso-list:ignore;"&gt;3. &lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Verdana" color="#333300" size="1"&gt;&lt;span style="font-size:9pt;color:#333300;font-family:verdana;"&gt;Open the watermark and compute the size. I do this as a percentage of the longest side of the image. This way, the watermark is exactly the same size for each photo on my site. Convert the watermark to the correct size (it is really large to begin with and I scale it down).&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-left:0.5in;text-indent:-0.25in;mso-list:l0 level1 lfo1;tab-stops:list .5in;"&gt;&lt;font face="Verdana" color="#333300" size="1"&gt;&lt;span style="font-size:9pt;color:#333300;font-family:verdana;mso-fareast-font-family:verdana;mso-bidi-font-family:verdana;"&gt;&lt;span style="mso-list:ignore;"&gt;4. &lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Verdana" color="#333300" size="1"&gt;&lt;span style="font-size:9pt;color:#333300;font-family:verdana;"&gt;Determine a location that the watermark will go on the photo. Crop a copy of the photo and get a histogram of the cropping. I then can determine the normalized median (half the pixels in the histogram array);between 0 and 1. This gives me how light/dark the area is. 0 is darkest, 1 is lightest.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-left:0.5in;text-indent:-0.25in;mso-list:l0 level1 lfo1;tab-stops:list .5in;"&gt;&lt;font face="Verdana" color="#333300" size="1"&gt;&lt;span style="font-size:9pt;color:#333300;font-family:verdana;mso-fareast-font-family:verdana;mso-bidi-font-family:verdana;"&gt;&lt;span style="mso-list:ignore;"&gt;5. &lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Verdana" color="#333300" size="1"&gt;&lt;span style="font-size:9pt;color:#333300;font-family:verdana;"&gt;I then duplicate the correct watermark layer over to the photo and adjust opacity based on the normalized median. For example, between 0 and .33 I use a 30% opacity image and &lt;span class="GramE"&gt;.44 to .50 I&lt;/span&gt; use a 50% opacity white image.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-left:0.5in;text-indent:-0.25in;mso-list:l0 level1 lfo1;tab-stops:list .5in;"&gt;&lt;font face="Verdana" color="#333300" size="1"&gt;&lt;span style="font-size:9pt;color:#333300;font-family:verdana;mso-fareast-font-family:verdana;mso-bidi-font-family:verdana;"&gt;&lt;span style="mso-list:ignore;"&gt;6. &lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;font face="Verdana" color="#333300" size="1"&gt;&lt;span style="font-size:9pt;color:#333300;font-family:verdana;"&gt;Move the watermark to the predefined location.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt; &lt;p class="MsoNormal"&gt;&lt;font face="Verdana" color="#333300" size="1"&gt;&lt;span style="font-size:9pt;color:#333300;font-family:verdana;"&gt;Of course, the watermark is many times not quite in the correct location and I just have to move it slightly. But overall this works pretty well and has definitely reduced my process while getting consistent results across photos.&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://scottholden.name/aggbug.aspx?PostID=23" width="1" height="1"&gt;</description><category domain="http://scottholden.name/archive/tags/Software/default.aspx">Software</category><category domain="http://scottholden.name/archive/tags/Hosting/default.aspx">Hosting</category><category domain="http://scottholden.name/archive/tags/Photoshop/default.aspx">Photoshop</category></item><item><title>Automating Photoshop for Web Site generation</title><link>http://scottholden.name/archive/2004/04/29/automating-photoshop-for-web-site-generation.aspx</link><pubDate>Thu, 29 Apr 2004 18:31:15 GMT</pubDate><guid isPermaLink="false">b9eea908-4a60-4fb4-8ee8-dc68b05b7b9a:22</guid><dc:creator>scottholden</dc:creator><slash:comments>0</slash:comments><comments>http://scottholden.name/comments/22.aspx</comments><wfw:commentRss>http://scottholden.name/commentrss.aspx?PostID=22</wfw:commentRss><description>&lt;p class="MsoNormal"&gt;&lt;span style="font-size:9pt;color:#333300;font-family:verdana;"&gt;&lt;font size="2"&gt;It is really cool what you can do to script photoshop. Since they want to allow VB scripting, there is a COM object provided so you can even use C#. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal"&gt;&lt;span style="font-size:9pt;color:#333300;font-family:verdana;"&gt;&lt;font size="2"&gt;All you need to do is &lt;i&gt;Add Reference &lt;/i&gt;in a C# project to the Adobe Photoshop CS COM object and voila, you have the "full" object model at your disposal. Unfortunately, not everything is strongly typed (use of Object parameters) and the documentation is poor, so it takes some trial and error. I found the JavaScript reference better than the VBScript reference.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal"&gt;&lt;span style="font-size:9pt;color:#333300;font-family:verdana;"&gt;&lt;font size="2"&gt;Anyways, I now have a tool that uses my custom web gallery, generates the gallery and then automatically generates my backup picture size so that I don't have to scale on the client and have my photos not look quite as good. Since I want all of my galleries to the look the same, I just have a few configuration parameters for each gallery and I write out the gallery list using the XmlSerializer. This allows me to hand edit the xml to add/remove/modify galleries and then auto regenerate everything.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal"&gt;&lt;span style="font-size:9pt;color:#333300;font-family:verdana;"&gt;&lt;font size="2"&gt;I guess I am removing all of the excuses to why I don't get new pics up in a timely manner ;) Next, on to automating the watermark and file info!&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal"&gt;&lt;span style="font-size:9pt;color:#333300;font-family:verdana;"&gt;&lt;font size="2"&gt;Scott.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;&lt;img src="http://scottholden.name/aggbug.aspx?PostID=22" width="1" height="1"&gt;</description><category domain="http://scottholden.name/archive/tags/Software/default.aspx">Software</category><category domain="http://scottholden.name/archive/tags/Hosting/default.aspx">Hosting</category><category domain="http://scottholden.name/archive/tags/Photoshop/default.aspx">Photoshop</category></item></channel></rss>