Photoshop open multiple image and add different texts


hi all,

 

hope doing great. started doing photoshop scripting due requirement mention in detail below.

 

my scripting knowledge basic hoping guys able me out this.

 

the requirment have 100's of images needs opened in photoshop and add text based on image name save image jpeg @ 70 quality. example:

 

i have images named below in desktop folder,

 

image1.jpg

image2.jpg

image3.jpg

image4.jpg

image5.jpg

image6.jpg

image7.jpg

image8.jpg

image9.jpg

image10.jpg

 

for script, think easiest way if define image name are:

 

image[1] = image1.jpg

image[2] = image2.jpg

image[3] = image3.jpg

image[4] = image4.jpg

image[5] = image5.jpg

image[6] = image6.jpg

image[7] = image7.jpg

image[8] = image8.jpg

image[9] = image9.jpg

image[10] = image10.jpg

 

and for text have done this:

 

text [1] = image1

text [2] = image2

text [3] = image3

text [4] = image4

text [5] = image5

text [6] = image6

text [7] = image7

text [8] = image8

text [9] = image9

text [10] = image10

 

so everytime when run script image1 added photoshop , text name image1 added (for think defining layer name better gave "imagetext").

 

then image saved on specific location on desktop.

 

i have plan on want don't know how write script using photoshop api , limited javascript coding.

 

so if guys me out this, awesome. hope hear on soon.

 

kind regards,

 

zoogle

this script want. didn't specify size images working with, font, text size & wanted text of file names be:

 

you should ale work out comments does.

record script action & run action batch file & it'll go through directory of image need do:

 

 

// photoshop  // call source document var srcdoc = app.activedocument;  //name file name after source file remove extension var docname = app.activedocument.name.substring(0,app.activedocument.name.length -4);  // set filepath , filename source path var filepath = srcdoc.path + "/" + docname + ".jpg";  // set jpeg quality var myjpegquality = 6;  // original width , height var w = srcdoc.width.value; var h = srcdoc.height.value;  // create text createtext("arial-boldmt", 18.0, 0,0,0, docname, w-100, h-10, "right")  // save out jpeg savemyfile(filepath, myjpegquality)  // close original file app.activedocument.close(saveoptions.donotsavechanges)  // function save file (filepath, quality) // ---------------------------------------------------------------- // function savemyfile (path, q) {    // jpg file options   var jpgfile = new file(path);   jpgsaveoptions = new jpegsaveoptions();   jpgsaveoptions.formatoptions = formatoptions.optimizedbaseline;   jpgsaveoptions.embedcolorprofile = true;   jpgsaveoptions.matte = mattetype.none;   jpgsaveoptions.quality = q;    try   {     activedocument.saveas(jpgfile, jpgsaveoptions, true, extension.lowercase);   }     catch(e)    {       //alert(e) cs5 problems!!    } }  // function create text(typeface, size, r, g, b, text content, text x pos, text y pos) // -------------------------------------------------------- function createtext(fface, size, colr, colg, colb, content, tx, ty, just) {    // add new layer in new document   var artlayerref = app.activedocument.artlayers.add()    // specify layer text layer   artlayerref.kind = layerkind.text    //this section defines color of hello world text   textcolor = new solidcolor();   textcolor.rgb.red = colr;   textcolor.rgb.green = colg;   textcolor.rgb.blue = colb;    //get reference text item can add text , format bit   textitemref = artlayerref.textitem   textitemref.font = fface;   textitemref.contents = content;   textitemref.color = textcolor;   textitemref.size = size   textitemref.position = new array(tx, ty) //pixels left, pixels top    if (just == "centre" || == "center" || = "c" || = "c") = justification.center   else if (just == "right" || == "right" || = "r" || = "r") = justification.right   else if (just == "left" || == "left" || = "l" || = "l") = justification.left   else (just = justification.left)    activedocument.activelayer.textitem.justification = }  


More discussions in Photoshop Scripting


adobe

Comments

Popular posts from this blog

Thread: Can not create raid array: mdadm: no raid-devices specified.

Thread: HOW TO: Package and theme GTK+ / Gtkmm apps in Linux for Windows

Thread: Twinview issues