Batch psd/tiff Document creation with guides

Discussion of Automation, Image Workflow and Raw Image Workflow

Moderators: xbytor, DavideBarranca, Paul MR

sachinrewa

Batch psd/tiff Document creation with guides

Postby sachinrewa » Fri Jun 29, 2012 11:11 am

Hi,
Making n number of covers in different sizes. Sizes are in Excel sheet for each books. Like Width 6 inch Height 9 inch and Spine 1 inch; bleed should be 0.125 inch all side (means front 6 inch +.0.25, spine 1 inch + 0.25, back 6 inch +.25 inch and height 9 inch +.25 ).

Some body can help to make batch tiff/psd document with guides.

Thanks in advance

Regards,
Sachin
sachinrewa@gmail.com

Paul MR

Batch psd/tiff Document creation with guides

Postby Paul MR » Fri Jun 29, 2012 11:38 am

If you want to create different templates, this might be of use...

http://www.scriptsrus.talktalk.net/CreateNewCanvas.htm

sachinrewa

Batch psd/tiff Document creation with guides

Postby sachinrewa » Fri Jun 29, 2012 1:46 pm

Thanks Paul for your reply.

It is not doing automation what I want to do. It is doing one at a time.

My posting is that suppose I want to make any number of books in PhotoShop. I have the each books width/height/spine and want to add bleed for each W H S for each books. And want guides for that.
(How can I attached one file for example with this post?)

Regards,
Sachin

sachinrewa

Batch psd/tiff Document creation with guides

Postby sachinrewa » Thu Jul 05, 2012 7:38 am

Hi Paul,

I have a Excel sheet with the height/width/spine, like:
S No. H W S
0012 9.25-6.15-1.2
1245 9.55-7.12-2.2
1824 9.75-8.24-1.6
1425 8.74-6.45-1.5
and bleed .125inch each side (H/W/S)

The script you are suggesting that can be use for the same size purpose.

Regards,
Sachin

Paul MR

Batch psd/tiff Document creation with guides

Postby Paul MR » Thu Jul 05, 2012 11:15 am

Hi Sachin, I think you you might require a seperate script.

You would need to reformat the Excel spreadsheet if you wanted to create documents direct.
JavaScript cann't read Excel spreedsheets directly, normally you would export to a csv file and read that.

To create a document you would need something like this (This is in Pixels):

Name,Width,Height,Resolution,RGB-CMYK,Guides Horizontal,Guides Vertical
Doc1,3000,2400,300,RGB,10;20;30;2980,10;20;2300;2320

The guides are separated by a semicolon.

A script could then read the csv file line by line and create the document(s) and all the quides.

sachinrewa

Batch psd/tiff Document creation with guides

Postby sachinrewa » Fri Jul 06, 2012 7:55 am

Hi Paul,
I have a 100s document (different sizes) Height/Width/Spine data and make canvas for that.
May you please help to make some thing to do this.

Sl No. Hight Wight Spine Full Width (Front+Back+Spine+Bleed (.75 in))
1884 9.25 6.2 1.09 14.24
1885 9.25 6.15 1.00 14.05
1886 9.25 6.2 0.79 13.94
1887 9.25 6.5 1.42 15.17
1888 9 5.8 #VALUE! 11.60
1889 9.25 6.25 0.92 14.17
so on.

Thanks in advance.

Regards,
Sachin

Paul MR

Batch psd/tiff Document creation with guides

Postby Paul MR » Fri Jul 06, 2012 10:41 am

Ok, here is an example, you must save the Excel spreedsheet to a CSV file to use this script!
I have assumed a resolution of 300 and an RGB document with a white background.
The psds will saved into the selected output folder.

Code: Select all#target photoshop
main();
function main(){
var csvFile = File.openDialog("Open Comma-delimited File","comma-delimited(*.csv):*.csv;");
if(csvFile == null) return;
var outputFolder = Folder.selectDialog("Please select the output folder");
if(outputFolder == null) return;
csvFile.open('r') ;
var csvString = csvFile.read();
csvFile.close();
csvString = csvString.split('\n');
// Change to suit
var Resolution = 300;
///////////////////////////////////////////
var strtRulerUnits = app.preferences.rulerUnits;            
var strtTypeUnits = app.preferences.typeUnits;            
app.preferences.rulerUnits = Units.PIXELS;            
app.preferences.typeUnits = TypeUnits.PIXELS;
for(var a in csvString){
if(csvString[a].length <5 ) continue;
var line = csvString[a].split(',');
if(isNaN(Number(line[0].replace(/^\s+|\s+$/g,'')))) continue;
var docName = line[0].replace(/^\s+|\s+$/g,'');
var Height = Number(line[1].replace(/^\s+|\s+$/g,''));
var Width = Number(line[4].replace(/^\s+|\s+$/g,''));
var Spline = Number(line[3].replace(/^\s+|\s+$/g,''));
var docHeight = Resolution * Height;
var docWidth = Resolution * Width;
var docSpline = Resolution * Spline;
var BleedWidth = Resolution * 0.75;
var BleedHeight = Resolution * 0.25;
var doc = app.documents.add(docWidth,docHeight,Resolution,docName,NewDocumentMode.RGB, DocumentFill.WHITE);
//Guides
var leftBleed = BleedWidth/2;
var rightBleed = docWidth  - leftBleed;
var topBleed = BleedHeight/2;
var bottomBleed = docHeight - topBleed;
var leftSpline = (docWidth/2) - (docSpline/2);
var rightSpline = (docWidth/2) + (docSpline/2);
guideLine(leftBleed,"Vrtc",'#Pxl');
guideLine(rightBleed,"Vrtc",'#Pxl');
guideLine(topBleed,"Hrzn",'#Pxl');
guideLine(bottomBleed,"Hrzn",'#Pxl');
guideLine(leftSpline,"Vrtc",'#Pxl');
guideLine(rightSpline,"Vrtc",'#Pxl');
var saveFile = File(outputFolder + "/" + docName + ".psd");
SavePSD(saveFile);
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
}
app.preferences.rulerUnits = strtRulerUnits;
app.preferences.typeUnits = strtTypeUnits;
};

function guideLine(position, type,unit) {
    var desc = new ActionDescriptor();
        var desc2 = new ActionDescriptor();
        desc2.putUnitDouble( charIDToTypeID('Pstn'), charIDToTypeID(unit), position);
        desc2.putEnumerated( charIDToTypeID('Ornt'), charIDToTypeID('Ornt'), charIDToTypeID(type) );
    desc.putObject( charIDToTypeID('Nw  '), charIDToTypeID('Gd  '), desc2 );
    executeAction( charIDToTypeID('Mk  '), desc, DialogModes.NO );
};
function SavePSD(saveFile){
psdSaveOptions = new PhotoshopSaveOptions();
psdSaveOptions.embedColorProfile = true;
psdSaveOptions.alphaChannels = true; 
psdSaveOptions.layers = true; 
activeDocument.saveAs(saveFile, psdSaveOptions, true, Extension.LOWERCASE);
}

sachinrewa

Batch psd/tiff Document creation with guides

Postby sachinrewa » Fri Jul 06, 2012 12:10 pm

Hi Paul,

You are genius. Thanks a lot.

I have notice there is some thing to update:
1. It is not adding .75 inch in width and .25 in Height for bleed.
2. After that it has to make guide each side .125 inch.
3. Spine like 1 inch both side guides is ok, It also make vertical 2 guides left side of spine distance .125 inch each and right side of spine 2 guides .125 inch each. Means 2 column in left and two column right of spine. Sample url given below.
https://www.dropbox.com/home/Canvas

Regards,
Sachin

Paul MR

Batch psd/tiff Document creation with guides

Postby Paul MR » Fri Jul 06, 2012 3:20 pm

I am confused Sachin, I am using the last number which should include the 0.75 bleed? Does the bleed want adding to the height?
The link you gave requires a logon. Is there somewhere else you could post a link?

Paul.

sachinrewa

Batch psd/tiff Document creation with guides

Postby sachinrewa » Sat Jul 07, 2012 4:28 am

Hi Paul,

Here is the another link. Hope it works.
https://www.dropbox.com/sh/aw4l113r6v53qtm/fB0VRTpMbY
if you will get this link picture will clear.

0.75 inch bleed in width and .25 inch in height. Example: 6 by 9 inch with 1 inch spine, Canvas will be 6*2+1+.75 in and height 9+.25 inch.

Regards,
Sachin


Return to “Automation & Image Workflow”

Who is online

Users browsing this forum: No registered users and 12 guests