Vector rectangle shape made with ExtendScript?

Discussion of Photoshop Scripting, Photoshop Actions and Photoshop Automation in General

Moderators: xbytor, DavideBarranca, Paul MR

Post Reply
fred
Posts: 1
Joined: Mon Feb 25, 2019 5:04 pm

Vector rectangle shape made with ExtendScript?

Post by fred » Tue Feb 26, 2019 9:59 am

Hello,

Is it possible to create a vector rectangle shape (rectangle tool) with ExtendScript?

I just want to create a 1px border around my PSD file and keep it vector in order to change the width later (to 2px for example).

Thanks for your help,

fred

User avatar
joonaspaakko
Posts: 6
Joined: Mon Apr 16, 2018 8:53 am

Re: Vector rectangle shape made with ExtendScript?

Post by joonaspaakko » Tue Feb 26, 2019 12:29 pm

Couple Action methods come to mind. Neither of these use shape layers but should be about as flexible in this case, if not more so...

Method #1
  • Layer > New Fill Layer...
  • Layer fill: 0
  • Layer style: Stroke (inset)
A possible downside is that since the stroke is inset, it might hide things behind it. For example, if you have a 100x100px photo and you give it a 100px stroke, the document will be nothing but stroke.

Method #2
  • Image > Trim... - (Check: Top left pixel color)
  • Image > Canvas Size... (Note that you can make the action stop here so you can set the relative width and height every time you run the action)
I added the Image > Trim there for the sake of the easy edits, but I thought I'd add a warning that it could totally destroy your image before it even gets to add the stroke. It would be better left off. Another possible downside is that the document size increases by the stroke width times two. This could also be considered a big plus as it doesn't cover anything like method #2.

AnilTejwani
Posts: 15
Joined: Wed Feb 22, 2017 5:37 pm

Re: Vector rectangle shape made with ExtendScript?

Post by AnilTejwani » Tue Mar 05, 2019 5:31 am

Here is script (zip fiel attached) that creates a 2px wide (stroke) rectangle around the full width/height of PSD.

Hope it helps.
Attachments
fill-full-rect.zip
(1.37 KiB) Downloaded 46 times

Post Reply