photoshop-script

Photoshop move layer along y-axis

非 Y 不嫁゛ 提交于 2021-02-04 21:45:22
问题 I'm working on a script that will move a layer, right, left, up, or down. This depends upon which edge of the layer is inside the canvas. I've managed to get the layer moving left and right (x-axis) using bounds[0] and bounds[2]. But when I try to get it to move up or down, it still moves left/right. Is it the bounds number I've got wrong? var Y1 = bounds[3].as('px'); var Height = app.activeDocument.height.as('px'); //move down if (Y1 < Height) { activeDocument.activeLayer.translate(Height-Y1

Get selected layers

点点圈 提交于 2021-01-29 06:02:40
问题 Unlike this question, is there a way to return an array of currently selected layers, without having to loop over all the layers and therefore removing/readjusting that selection? function get_selected_layers() { var layers = app.activeDocument.activeLayer; // only works with *last* selected layer // not *all* selected layers } var thelayers = get_selected_layers; alert(thelayers); 回答1: Sort of but not really. There's no native way of getting an array of selected artLayer objects. But there's

[ExtendScript]Change font color, size of certain word in text layer

我怕爱的太早我们不能终老 提交于 2021-01-27 10:55:10
问题 I want replace font color and weight and size of certain word in text layer. For example: I want <b>THIS</b> look different and <b>this</b> as well. My plan was replacing every characters' color between <b> and </b> then "<b>" and "</b>" to be removed. First of all, I'd like to know that changing colors and size of certain words in a text layer would even be feasible. Another thing is, even if I somehow manage to change font color in a text layer and then remove <b> and </b>, font colors

Writing binary file using in Extendscript. Incorrect file size

一个人想着一个人 提交于 2020-08-05 10:06:06
问题 Further to my question here I'm writing a list of hex colours to a binary file from within Photoshop using Extendscript. So far so good. Only the binary file written with the code below is 119 bytes. When cut and pasted and saved using Sublime Text 3 it's only 48 bytes, which then causes complications later on. This is my first time in binary land, so I may be a little lost. I suspect it's an either an encoding issue (which could explain the 2.5 file size), or doing something very wrong

Photoshop JavaScript: options to open a PDF as smart object

戏子无情 提交于 2020-01-04 05:40:09
问题 I'm trying to open a PDF file as a smart object layer in Photoshop (CS5). Croped to the trimbox. It works when using openDialog() and open() . But in case the property asSmartObject is true the PDFOpenOptions.cropPage = CropToType.TRIMBOX will be ignored. There have to be options to open as smart object, like the PDFOpenOptions . But I can't find them, did you? My page should be croped to the trimbox with a minimum height/width of 400 px. Open the PDF as rendered pic won't work, because

Java script for “Save for Web” in photoshop not producing good quality image

北慕城南 提交于 2020-01-03 05:48:12
问题 #target photoshop var doc = app.activeDocument; if (doc == null) { throw "No Valid document available for export."; } if (doc.width != doc.height) { throw "Image is not square"; } var startState = doc.activeHistoryState; // save for undo var initialPrefs = app.preferences.rulerUnits; // will restore at end app.preferences.rulerUnits = Units.PIXELS; // use pixels // Folder selection dialog var destFolder = Folder.selectDialog( "Select Output folder"); // Save icons in PNG using Save for Web.