create solid fillled files from csv

Discussion of Automation, Image Workflow and Raw Image Workflow

Moderators: xbytor, DavideBarranca, Paul MR

flieckster

create solid fillled files from csv

Postby flieckster » Thu Apr 03, 2008 2:35 am

Hi guys, i want to make a csv file that looks like this.

file name hex value
1234 fdfcfc

and i want photoshop to read the csv file and export out all the files with solid fills of the hex values in the list.
is this possible?

thanks guys

Patrick

create solid fillled files from csv

Postby Patrick » Thu Apr 03, 2008 2:36 pm

Try this:

CSV:Code: Select allorange,fe7011
apple,c80303
banana,ffd800
pear,00ff00

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
crop.open('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
   doc.selection.selectAll();
   doc.selection.fill(color);
   
   // save file
   var image = new File("/c/sandbox/"+ part[0] +".jpg");
   SaveJPEG(image,12);

   // close document
   doc.close(SaveOptions.DONOTSAVECHANGES);

}

// close file
crop.close();


Patrick

flieckster

create solid fillled files from csv

Postby flieckster » Wed Apr 09, 2008 9:13 pm

thanks for the info patrick, but i think i'm having a problem loading scripts in photoshop vs bridge. can you direct me to place where it describes where you load photoshop scripts and how to use them?

thanks i cant wait to use this.

Patrick

create solid fillled files from csv

Postby Patrick » Wed Apr 09, 2008 9:22 pm

You can save the code as a .jsx file wherever you want on your hard drive, and in photoshop go to:

File -> Scripts -> Browse...

If I use a script a lot, just record a action of loading the script like above. You can then use the action as a one button way of getting to the script after that.

Patrick

flieckster

create solid fillled files from csv

Postby flieckster » Thu Apr 10, 2008 4:08 pm

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

says undefined is not an object.

flieckster

create solid fillled files from csv

Postby flieckster » Thu Apr 10, 2008 4:14 pm

forget it, i figured it out. wow this rocks.

raunaqsingh
Posts: 2
Joined: Sat Dec 10, 2016 9:32 am

Re: create solid fillled files from csv

Postby raunaqsingh » Sat Dec 10, 2016 9:34 am

Hi, how did you solve the issue?
Last edited by raunaqsingh on Sat Dec 10, 2016 9:34 am, edited 1 time in total.

raunaqsingh
Posts: 2
Joined: Sat Dec 10, 2016 9:32 am

Re: create solid fillled files from csv

Postby raunaqsingh » Sat Dec 10, 2016 9:34 am

forget it, i figured it out. wow this rocks.
Hi, how did you solve the issue?


Return to “Automation & Image Workflow”

Who is online

Users browsing this forum: No registered users and 2 guests