Create plain color files

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: xbytor, DavideBarranca, Paul MR

Posts: 1
Joined: Fri Feb 16, 2018 3:45 am

Create plain color files

Postby Sara » Fri Feb 16, 2018 4:26 am


Hoping someone can help with this, I found this post which was almost 10 years old! It seems that it will do what I need, but it errors on line 27
With "Error 1220 Illegal Argument color.rbg["hexValue"]=part[1];

Thank you :-)
Try this:

CSV:Code: Select allorange,fe7011

JSX:Code: Select allfunction SaveJPEG(saveFile, jpegQuality){
   jpgSaveOptions = new JPEGSaveOptions()
   jpgSaveOptions.embedColorProfile = true
   jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE
   jpgSaveOptions.matte = MatteType.NONE
   jpgSaveOptions.quality = jpegQuality //1-12
   activeDocument.saveAs(saveFile, jpgSaveOptions, true,Extension.LOWERCASE)

// read in result file
var crop = new File("/c/sandbox/fruit.csv");

// open file'r');

while (!crop.eof)
   // read line of csv
   var line = crop.readln();
   var part = line.split(',');

   // create doc
   var doc = app.documents.add(100, 100, 72, part[0], NewDocumentMode.RGB);

   // define your fill color
   var color = new SolidColor();
   color.rgb["hexValue"] = part[1];
   // fill layer
   // save file
   var image = new File("/c/sandbox/"+ part[0] +".jpg");

   // close document


// close file


Return to “Help Me”

Who is online

Users browsing this forum: No registered users and 10 guests