{"id":1813,"date":"2014-09-08T11:21:57","date_gmt":"2014-09-08T18:21:57","guid":{"rendered":"http:\/\/thelawlers.com\/Blognosticator\/?p=1813"},"modified":"2023-02-13T09:12:19","modified_gmt":"2023-02-13T17:12:19","slug":"drawing-on-the-photoshop-side-of-the-brain","status":"publish","type":"post","link":"https:\/\/thelawlers.com\/Blognosticator\/?p=1813","title":{"rendered":"Drawing on the Photoshop side of the brain"},"content":{"rendered":"<p><a href=\"https:\/\/thelawlers.com\/Blognosticator\/wp-content\/uploads\/2014\/07\/Blognosticator-Head.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1755\" src=\"https:\/\/thelawlers.com\/Blognosticator\/wp-content\/uploads\/2014\/07\/Blognosticator-Head.png\" alt=\"Blognosticator Head\" width=\"252\" height=\"115\" \/><\/a><\/p>\n<p>A few blogs ago I wrote about how to use <em>AppleScript<\/em> to crop a <em>Photoshop<\/em> document with pixel precision. As part of that same project, I needed to add white space to the canvas and trim marks top and bottom along the edges to mark the location of a cut that was made later on a large metal cutting shear.<\/p>\n<p>The resizing of the canvas is easy. The AppleScript code looks like this:<\/p>\n<pre><span style=\"color: #0000ff;\"><strong>resize canvas<\/strong><\/span> <span style=\"color: #008000;\">_CroppedPano<\/span> <span style=\"color: #993366;\">width<\/span> 11287 <span style=\"color: #993366;\">height<\/span> 17700<\/pre>\n<p>This, of course, must be placed within the construct of a script, but looking at the syntax of the instruction, it says simply, \u201cmake the canvas bigger (or smaller) to these dimensions: 11287 X 17700 pixels.\u201d AppleScript and Photoshop will carry out your instructions without delay and without asking if it\u2019s OK, so be careful to be accurate with any script that makes changes like this.<\/p>\n<p><span style=\"color: #008000;\">_CroppedPano<\/span> is my variable name for the photo on which I am making the changes.<\/p>\n<p>Now let\u2019s look at how the crop marks are drawn. Photoshop, like Illustrator, uses the Cartesian coordinate system for all of its measurements. Upper-left is 0,0 (early versions of Illustrator put that 0,0 at the lower-left). Photoshop measures everything in the current measurement unit, whatever that may be. At the top of my script I tell Photoshop to use the pixel unit of measure:<\/p>\n<pre>set <span style=\"color: #800080;\">ruler units<\/span> of <span style=\"color: #800080;\">settings<\/span> to <em>pixel units<\/em><\/pre>\n<p>From this moment on, the program is computing values in pixels.<\/p>\n<p>This is the way Cartesian coordinates work in Photoshop (and everywhere else):<\/p>\n<p><a href=\"https:\/\/thelawlers.com\/Blognosticator\/wp-content\/uploads\/2014\/09\/Cartesian-diagram.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1816\" src=\"https:\/\/thelawlers.com\/Blognosticator\/wp-content\/uploads\/2014\/09\/Cartesian-diagram.jpg\" alt=\"Print\" width=\"461\" height=\"693\" srcset=\"https:\/\/thelawlers.com\/Blognosticator\/wp-content\/uploads\/2014\/09\/Cartesian-diagram.jpg 461w, https:\/\/thelawlers.com\/Blognosticator\/wp-content\/uploads\/2014\/09\/Cartesian-diagram-199x300.jpg 199w\" sizes=\"auto, (max-width: 461px) 100vw, 461px\" \/><\/a><\/p>\n<p>The crop marks I want to draw are one pixel wide and 150 pixels tall (in this example, that\u2019s 1\/2 inch). I needed one at the top and bottom of each panel, on both the left and right edges, and one-half inch in from the edges (these are crop marks).<\/p>\n<p>Here is the code for the AppleScript to make the first mark at the upper-left of the photo:<\/p>\n<pre><strong>set<\/strong> <span style=\"color: #008000;\">_LineShape<\/span> <strong>to<\/strong> {{150, 0}, {150, 150}, {151, 150}, {151, 0}}<\/pre>\n<pre><span style=\"color: #3366ff;\"><strong>select<\/strong><\/span> <span style=\"color: #800080;\">current document<\/span> <span style=\"color: #3366ff;\">region<\/span> <span style=\"color: #008000;\">_LineShape<\/span><\/pre>\n<pre><strong><span style=\"color: #3366ff;\">fill<\/span><\/strong> <span style=\"color: #800080;\">selection<\/span> <strong>of<\/strong> <span style=\"color: #800080;\">current document with contents<\/span> {<em><span style=\"color: #3366ff;\">class:RGB color<\/span><\/em>, <span style=\"color: #800080;\">red<\/span>:0, <span style=\"color: #800080;\">green<\/span>:0, <span style=\"color: #800080;\">blue<\/span>:0} <span style=\"color: #800080;\">opacity<\/span> 100 <strong>without<\/strong> <span style=\"color: #3366ff;\">preserving transparency<\/span><\/pre>\n<pre><strong><span style=\"color: #3366ff;\">deselect<\/span><\/strong> <span style=\"color: #800080;\">current document<\/span><\/pre>\n<p>Parsing those lines of code, the first line lists the Cartesian coordinates of a 1-pixel by 150-pixel rectangle, located 150 pixels from the left edge of the image. The second line of code tells Photoshop to create the variable <span style=\"color: #008000;\">_LineShape<\/span> (which is the name of the line I am drawing). The next line fills the shape with black (RGB 000) with 100% opacity and no transparency. The last line deselects the current selection so that I can make another selection.<\/p>\n<p>The other three crop marks are made the same way, but with different coordinates in the x,y positions for all corners.<\/p>\n<p>At the end of the script I return Photoshop to inches units for measure:<\/p>\n<pre><strong>set<\/strong> <span style=\"color: #800080;\">ruler units<\/span> <strong>of<\/strong> <span style=\"color: #800080;\">settings<\/span> to <em><span style=\"color: #800080;\">inch units<\/span><\/em><\/pre>\n<p>\u2026and then I end the script. The result is a photo with a larger canvas (the background color is used to expand the canvas) and crop marks on the corners:<\/p>\n<p>Running the script \u2013 even on multi-gigabyte files \u2013 takes just a few seconds. It is absolutely precise and absolutely repeatable.<\/p>\n<p>Here is a photo showing crop marks like those I have described here:<\/p>\n<p><a href=\"https:\/\/thelawlers.com\/Blognosticator\/wp-content\/uploads\/2014\/09\/Burning-Man-at-with-marks.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1815\" src=\"https:\/\/thelawlers.com\/Blognosticator\/wp-content\/uploads\/2014\/09\/Burning-Man-at-with-marks.jpg\" alt=\"Burning Man at with marks\" width=\"324\" height=\"558\" srcset=\"https:\/\/thelawlers.com\/Blognosticator\/wp-content\/uploads\/2014\/09\/Burning-Man-at-with-marks.jpg 324w, https:\/\/thelawlers.com\/Blognosticator\/wp-content\/uploads\/2014\/09\/Burning-Man-at-with-marks-174x300.jpg 174w\" sizes=\"auto, (max-width: 324px) 100vw, 324px\" \/><\/a><\/p>\n<p>Notice that it has pairs of one-pixel-wide crop marks top and bottom, left and right. That is exactly what the script does, after it increases\u00a0the canvas size.<\/p>\n<p>When you need precision, and I often do, using techniques like this can make a job successful where dragging rectangles on screen will not be as accurate.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A few blogs ago I wrote about how to use AppleScript to crop a Photoshop document with pixel precision. As part of that same project, I needed to add white space to the canvas and trim marks top and bottom &hellip; <a href=\"https:\/\/thelawlers.com\/Blognosticator\/?p=1813\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,30],"tags":[423,405,407,64,424,425],"class_list":["post-1813","post","type-post","status-publish","format-standard","hentry","category-photography","category-technology","tag-applescript","tag-applescripting-photoshop","tag-automating-photoshop","tag-brian-lawler","tag-photoshop","tag-scripting-crop-marks"],"_links":{"self":[{"href":"https:\/\/thelawlers.com\/Blognosticator\/index.php?rest_route=\/wp\/v2\/posts\/1813","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thelawlers.com\/Blognosticator\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thelawlers.com\/Blognosticator\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thelawlers.com\/Blognosticator\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/thelawlers.com\/Blognosticator\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1813"}],"version-history":[{"count":2,"href":"https:\/\/thelawlers.com\/Blognosticator\/index.php?rest_route=\/wp\/v2\/posts\/1813\/revisions"}],"predecessor-version":[{"id":3519,"href":"https:\/\/thelawlers.com\/Blognosticator\/index.php?rest_route=\/wp\/v2\/posts\/1813\/revisions\/3519"}],"wp:attachment":[{"href":"https:\/\/thelawlers.com\/Blognosticator\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1813"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thelawlers.com\/Blognosticator\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1813"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thelawlers.com\/Blognosticator\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1813"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}