Looking for a script that will size photos down and give unique filenames


here's challenge:

 

i have bunch of photos need sized down 3 different types of thumbnails, each group of thumbnails needs have specific prefix filename while keeping rest of filename in tact.

 

so example:

 

i start out photo 1400 x 933

that photo needs sized down 3 different smaller sizes: 630 x 420, 210 x 140 , 140 x93 (all of have same aspect ratio 1400 x 933). far simple action in photoshop.

 

the trick can't figure out these photos need have specific file naming convention. example 1400 x 933 photo start out named w_paul_001.jpg other photos once sized down need be: x_paul_001.jpg (for 630x420), y_paul_001.jpg (for 210 x 140) , z_paul_001.jpg (for 140x93).

 

how dat?

this want:

 var srcdoc = app.activedocument; var imgnum = srcdoc.name.substring(7, (srcdoc.name.length)-4); var myjpgquality = 12  var sizearray = [ [1400, 933, "x_paul_"], [630,  420, "y_paul_"], [100,  100, "z_paul_"] ]  (var i=0; i<sizearray.length; i++) {   var shrinkwidth =  sizearray [i][0];   var shrinkheight = sizearray [i][1];   var mysavename = sizearray [i][2];    var id428 = charidtotypeid( "dplc" );   var desc92 = new actiondescriptor();   var id429 = charidtotypeid( "null" );   var ref27 = new actionreference();   var id430 = charidtotypeid( "dcmn" );   var id431 = charidtotypeid( "ordn" );   var id432 = charidtotypeid( "frst" );   ref27.putenumerated( id430, id431, id432 );   desc92.putreference( id429, ref27 );   var id433 = charidtotypeid( "nm  " );   desc92.putstring( id433, mysavename );   executeaction( id428, desc92, dialogmodes.no );    activedocument.resizeimage(shrinkwidth, shrinkheight, 72, resamplemethod.bicubic);   filepath = srcdoc.path + '/' + mysavename + imgnum + '.jpg';   var jpgfile = new file(filepath);   jpgsaveoptions = new jpegsaveoptions();   jpgsaveoptions.formatoptions = formatoptions.optimizedbaseline;   jpgsaveoptions.embedcolorprofile = true;   jpgsaveoptions.matte = mattetype.none;   jpgsaveoptions.quality = myjpgquality;    activedocument.saveas(jpgfile, jpgsaveoptions, true, extension.lowercase);   app.activedocument.close(saveoptions.donotsavechanges); } 


More discussions in Photoshop Scripting


adobe

Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support