Add Stroke to Text Layer

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

User avatar
Kukurykus
Posts: 528
Joined: Mon Jul 25, 2016 12:36 pm

Add Stroke to Text Layer

Post by Kukurykus »

by mikedpe » Sat Jun 13, 2020 4:44 pm (originally at: posting.php?mode=reply&f=66&t=40660&p=169778#p169778)
I can create text layers and add text to them but do not know how to add a stroke to the layer in javascript. As usual help appreciated

Mike

Code: Select all

(aD = activeDocument).activeLayer
.rasterize(RasterizeType.TEXTCONTENTS);
(col = new SolidColor()).rgb.hexValue = '000000'
aD.selection.stroke(col, 1, StrokeLocation.CENTER,
ColorBlendMode.NORMAL, 100, false)
mikedpe
Posts: 3
Joined: Thu Jun 11, 2020 9:10 am

Re: Add Stroke to Text Layer

Post by mikedpe »

That's a lot more compact that what I found via scriptListener, is it possible to do that without rasterizing the text?

Many thanks for the help

Mike
Last edited by mikedpe on Sat Jun 13, 2020 4:53 pm, edited 1 time in total.
User avatar
Kukurykus
Posts: 528
Joined: Mon Jul 25, 2016 12:36 pm

Re: Add Stroke to Text Layer

Post by Kukurykus »

If I correctly understand 'compact' word, this is more comapact, but yes to avoid rasterizing you have to apply effects, but then you finish up with more code. If you later won't need to edit text, then you can use DOM method.