photoshop-script

How to load a selection?

旧时模样 提交于 2019-12-25 09:28:58
问题 I am trying to load my selection like the picture below, where the marching ants go around the edges of my object: However, i only know how to select the whole layer using this code: doc.selection.selectAll(); Also, i want to contract the selection by a few pixels and paste it into a channel layer. Any help with that would be great but the most important thing is how to load the selection in the first place. 回答1: If you look up in the Javascript Scripting Reference document in your Photoshop

photoshop cs3 scripting - font names

≯℡__Kan透↙ 提交于 2019-12-24 14:22:33
问题 i am trying to set the font of a textItem, using textItem.font which accepts a string, but i do not know the exact font names to refer in code, i am trying to achieve something like this var newLayer = docRef_1.artLayers.add(); newLayer.kind=LayerKind.TEXT; var textItemRef = newLayer.textItem; textItemRef.contents = someCharacter; textItemRef.size = 120; textItemRef.font="Verdana-Bold"; but the font names to refer in code are not the same as they appear in photoshop UI for e.g Arial is

Photoshop scripting: app.activeDocument is undefined

独自空忆成欢 提交于 2019-12-24 12:21:51
问题 I'm trying to access current opened document in script, but it's undefined. But i have opened document in Photoshop. Should i initialize it somehow? Here is my code function ProcessDocumentWithoutXML() { g_rootDoc = app.activeDocument; g_progBar = new ProgressBar(); if (app.activeDocument != null) { ProcessLayersWithoutXML(g_rootDoc); alert("Done!"); } else { alert("Missing active document"); } } ProcessDocumentWithoutXML(); 回答1: In order for it to work g_rootDoc = app.activeDocument; needs

Photoshop Script: exportDocument

南楼画角 提交于 2019-12-23 09:33:58
问题 I want to save my image as a transparent PNG and wrote a script which suddenly stopped working. I get this error message: docExportOptions = new ExportOptionsSaveForWeb docExportOptions.format = SaveDocumentType.PNG //-24 //JPEG, COMPUSERVEGIF, PNG-8, BMP docExportOptions.transparency = true docExportOptions.blur = 0.0 docExportOptions.includeProfile = false docExportOptions.interlaced = false docExportOptions.optimized = true docExportOptions.quality = 100 docExportOptions.PNG8 = false

Photoshop Script to create text in a bitmap image in Photoshop

拈花ヽ惹草 提交于 2019-12-21 23:47:48
问题 I have very large size 1-bit images that I need to write arrays of text to in Photoshop. I can do this in javascript by converting the images to grayscale and then creating a new layer for each block of text, but I would like to be able to write text directly onto the 1-bit bitmap to save time. Is there a way to do this in javascript? 回答1: You can create text with scripting. You will need to be in grayscale (or RGB) to do so. Here's a basic text function. You will have to position the text

How to load an image in active document? (Photoshop Scripting)

旧街凉风 提交于 2019-12-21 04:36:12
问题 I am new to photoshop scripting. I want to load an image image (from my hard disk) into the active document as a new layer with positioning. How can this be done? Can somebody please share the code? Thanks 回答1: You can open Photoshop File Dialog for searching your image and adding that into a layer file = app.openDialog();//opens dialog,choose one image if(file[0]){ //if you have chosen an image app.load(file[0]); //load it into documents backFile= app.activeDocument; //prepare your image

Photoshop script to export layer combinations

别等时光非礼了梦想. 提交于 2019-12-13 16:28:17
问题 I want to make a Photoshop script that lets me export all five layers in a group to a png file - in combination with every single layer from 2 other groups. It's a bit vague so I'll try to illustrate what I want to accomplish. There's the base group (red, blue, yellow, orange, green). Then there is a second group that contains layers 1,2 and 3. Then there's a third group that contains a, b, c and d. I want to be able to export 1_red_a.png, 1_red_b.png, 1_red_c.png, 1_red_d.png, 1_blue_a.png,

Is there a script that can transfer text from an excel file into an Adobe design program?

吃可爱长大的小学妹 提交于 2019-12-13 07:49:57
问题 We're making a quiz game. We have a question bank on a Google Drive Spreadsheet. We have a designer who has made a generic design for the question cards, in Photoshop. Now, can we somehow transfer the questions, with the corresponding answers, onto this design through some script, code, or any other automated process? I know there's a thing called PhotoshopScript, could that be worth taking a closer look at? 回答1: Yes, it can be done. A sample is this video that does something similar: https:/

How to align Smart Object layer center to the canvas?

狂风中的少年 提交于 2019-12-13 01:25:22
问题 I've been googling all day to find a way to align a layer which is converted to Smart Object center to the canvas proceeded by scripting, but haven't found a solution so far. I ended up with the code below, but it doesn't do the job. Could anyone help, please? var baseFile = new File(openDialog()); //open base JPEG file var workFile = new File(openDialog()); //open work JPEG file var baseDoc = app.open(baseFile); var workDoc = app.open(workFile); createSO(workDoc.layers[0]); workDoc

Use Photoshop JavaScript to Execute System Command Line Prompt

一笑奈何 提交于 2019-12-12 05:47:33
问题 I'm using Photoshop to automate processing images using action sets. I have added javascript to one of my action sets. I want to issue a windows command line prompt using the javascript. Is this possible? Is there some type of system_exec() function for doing this? Edit: Here's an easy test app.system("mshta javascript:alert(\"Hello World\");close();"); 回答1: You can do this: app.system("some Windows command") E.g. app.system("echo hi > C:\hi.txt") 来源: https://stackoverflow.com/questions