create an action

U
Posted By
uvkhanna
Jun 2, 2008
Views
855
Replies
12
Status
Closed
hi i am a photographer. I want to create an action(automated task) for my pasport size photgraph (1.5’x 2′). I want that phtoshop will automatically create 32 copies of that photo & arrange them properly in another file (file size 8×12).

How to Improve Photoshop Performance

Learn how to optimize Photoshop for maximum speed, troubleshoot common issues, and keep your projects organized so that you can work faster than ever before!

TK
Toobi-Won Kenobi
Jun 3, 2008
wrote in message
hi i am a photographer. I want to create an action(automated task) for my pasport size photgraph (1.5’x 2′). I want that phtoshop will automatically create 32 copies of that photo & arrange them properly in another file (file size 8×12).

Have you tried File>Automate>Contact Sheet II?

TWK
U
uvkhanna
Jun 4, 2008
On Jun 4, 4:52 am, "Toobi-Won Kenobi" <Toobi-won > wrote:
wrote in message

hi i am a photographer. I want to create an action(automated task) for my pasport size photgraph (1.5’x 2′). I want that phtoshop will automatically create 32 copies of that photo & arrange them properly in another file (file size 8×12).

Have you tried File>Automate>Contact Sheet II?

TWK

yeah i tried it but its have fixed file size like 8×10. I need file size 8×12, 150 resolution & 32 photograph on single sheet.
PR
Paul_R
Jun 4, 2008
You could write yourself a custom script to do the job.
As an example if you save your Photo to a Folder 32 times with nothing else inn that folder you can run a script that I wrote a while back that creates montages.
http://www.ps-scripts.com/bb/viewtopic.php?t=1824
that should give you the 32 photos on one page.
Or you could modify the script to use the one photo 32 times.

"uv" wrote in message
On Jun 4, 4:52 am, "Toobi-Won Kenobi" <Toobi-won > wrote:
wrote in message

hi i am a photographer. I want to create an action(automated task) for my pasport size photgraph (1.5’x 2′). I want that phtoshop will automatically create 32 copies of that photo & arrange them properly in another file (file size 8×12).

Have you tried File>Automate>Contact Sheet II?

TWK

yeah i tried it but its have fixed file size like 8×10. I need file size 8×12, 150 resolution & 32 photograph on single sheet.
TK
Toobi-Won Kenobi
Jun 4, 2008
"uv" wrote in message
On Jun 4, 4:52 am, "Toobi-Won Kenobi" <Toobi-won > wrote:
wrote in message

hi i am a photographer. I want to create an action(automated task) for my pasport size photgraph (1.5’x 2′). I want that phtoshop will automatically create 32 copies of that photo & arrange them properly in another file (file size 8×12).

Have you tried File>Automate>Contact Sheet II?

TWK

yeah i tried it but its have fixed file size like 8×10. I need file size 8×12, 150 resolution & 32 photograph on single sheet.

uv,

You can change the page size to suit, also the resolution as well. Just highlight and type what you want in the size and resolution boxes. You then need to change the layout to 4 across and 8 down.

TWK
U
uvkhanna
Jun 4, 2008
On Jun 5, 12:12 am, "Paul R" wrote:
You could write yourself a custom script to do the job.
As an example if you save your Photo to a Folder 32 times with nothing else inn that folder you can run a script that I wrote a while back that creates montages.http://www.ps-scripts.com/bb/viewtopic.php?t=1824 that should give you the 32 photos on one page.
Or you could modify the script to use the one photo 32 times.
"uv" wrote in message

On Jun 4, 4:52 am, "Toobi-Won Kenobi" <Toobi-won > wrote:

wrote in message


hi i am a photographer. I want to create an action(automated task) for my pasport size photgraph (1.5’x 2′). I want that phtoshop will automatically create 32 copies of that photo & arrange them properly in another file (file size 8×12).

Have you tried File>Automate>Contact Sheet II?

TWK

yeah i tried it but its have fixed file size like 8×10. I need file size 8×12, 150 resolution & 32 photograph on single sheet.

hi paul, thanks for script, but plz tell me how to run the script. is there any action command in phtoshop will not work for my task. plz reply me
TK
Toobi-Won Kenobi
Jun 4, 2008
"uv" wrote in message
On Jun 5, 12:12 am, "Paul R" wrote:
You could write yourself a custom script to do the job.
As an example if you save your Photo to a Folder 32 times with nothing else
inn that folder you can run a script that I wrote a while back that creates
montages.http://www.ps-scripts.com/bb/viewtopic.php?t=1824 that should give you the 32 photos on one page.
Or you could modify the script to use the one photo 32 times.
"uv" wrote in message

On Jun 4, 4:52 am, "Toobi-Won Kenobi" <Toobi-won > wrote:

wrote in message


hi i am a photographer. I want to create an action(automated task) for my pasport size photgraph (1.5’x 2′). I want that phtoshop will automatically create 32 copies of that photo & arrange them properly in another file (file size 8×12).

Have you tried File>Automate>Contact Sheet II?

TWK

yeah i tried it but its have fixed file size like 8×10. I need file size 8×12, 150 resolution & 32 photograph on single sheet.

hi paul, thanks for script, but plz tell me how to run the script. is there any action command in phtoshop will not work for my task. plz reply me

You don’t need a script!
File>Automate>Contact Sheet II and change the dimensions to suit!

TWK
TK
Toobi-Won Kenobi
Jun 4, 2008
"Toobi-Won Kenobi" <Toobi-won > wrote in message
"uv" wrote in message
On Jun 5, 12:12 am, "Paul R" wrote:
You could write yourself a custom script to do the job.
As an example if you save your Photo to a Folder 32 times with nothing else
inn that folder you can run a script that I wrote a while back that creates
montages.http://www.ps-scripts.com/bb/viewtopic.php?t=1824 that should give you the 32 photos on one page.
Or you could modify the script to use the one photo 32 times.
"uv" wrote in message

On Jun 4, 4:52 am, "Toobi-Won Kenobi" <Toobi-won > wrote:

wrote in message


hi i am a photographer. I want to create an action(automated task) for
my pasport size photgraph (1.5’x 2′). I want that phtoshop will automatically create 32 copies of that photo & arrange them properly in another file (file size 8×12).

Have you tried File>Automate>Contact Sheet II?

TWK

yeah i tried it but its have fixed file size like 8×10. I need file size 8×12, 150 resolution & 32 photograph on single sheet.

hi paul, thanks for script, but plz tell me how to run the script. is there any action command in phtoshop will not work for my task. plz reply me

You don’t need a script!
File>Automate>Contact Sheet II and change the dimensions to suit!
Bummer!
Only 1 image, (I need to lay off the sauce) you do need a script. Have you loaded the .jsx file into the script folder, C:\Program Files\Adobe\Adobe Photoshop (version)\Presets\Scripts?
It should then appear in the File>Scripts menu.
Clicking on the required script should bring up a dialogue box.

TWK

TK
Toobi-Won Kenobi
Jun 4, 2008
"Paul R" wrote in message
You could write yourself a custom script to do the job.
As an example if you save your Photo to a Folder 32 times with nothing else inn that folder you can run a script that I wrote a while back that creates montages.
http://www.ps-scripts.com/bb/viewtopic.php?t=1824
that should give you the 32 photos on one page.
Or you could modify the script to use the one photo 32 times.
Paul,

Not bad, but I’m not sure that is much quicker, taking into account the amount of preparation required on the source files, sizing, cropping etc., to prevent distortion when placed in the montage.

TWK
PR
Paul_R
Jun 5, 2008
This will do the job in seconds. It will prompt you for the picture. NB: The picture Must be the correct size and resolution 1.5" x 2" @150PPI

#target photoshop
var File1 = File.openDialog("Please select Photo ","*.*"); open(File1);
var doc = activeDocument;
var strtRulerUnits = app.preferences.rulerUnits;
var strtTypeUnits = app.preferences.typeUnits;
app.preferences.rulerUnits = Units.PIXELS;
app.preferences.typeUnits = TypeUnits.PIXELS;
if(doc.width < doc.height) doc.rotateCanvas(90);
if(doc.width ==300 && doc.height == 225){
doc.selection.selectAll();
doc.selection.copy();
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
processPic();
}else{
alert ("Sorry your picture is not 225 pixels x 300 pixels") }
app.preferences.rulerUnits = strtRulerUnits;
app.preferences.typeUnits = strtTypeUnits;

function processPic(){
var doc = app.documents.add(1200, 1800, 150, null, NewDocumentMode.RGB, DocumentFill.WHITE);
MakeSelection(600,675,900,900);
MakeSelection(900,675,1200,900);
MakeSelection(300,675,600,900);
MakeSelection(0,675,300,900);
MakeSelection(900,900,1200,1125);
MakeSelection(600,900,900,1125);
MakeSelection(300,900,600,1125);
MakeSelection(0,900,300,1125);
MakeSelection(900,1125,1200,1350);
MakeSelection(600,1125,900,1350);
MakeSelection(300,1125,600,1350);
MakeSelection(0,1125,300,1350);
MakeSelection(900,1350,1200,1575);
MakeSelection(600,1350,900,1575);
MakeSelection(300,1350,600,1575);
MakeSelection(0,1350,300,1575);
MakeSelection(900,1575,1200,1800);
MakeSelection(600,1575,900,1800);
MakeSelection(300,1575,600,1800);
MakeSelection(0,1575,300,1800);
MakeSelection(900,450,1200,675);
MakeSelection(600,450,900,675);
MakeSelection(300,450,600,675);
MakeSelection(0,450,300,675);
MakeSelection(900,225,1200,450);
MakeSelection(600,225,900,450);
MakeSelection(300,225,600,450);
MakeSelection(0,225,300,450);
MakeSelection(900,0,1200,225);
MakeSelection(600,0,900,225);
MakeSelection(300,0,600,225);
MakeSelection(0,0,300,225);
activeDocument.flatten();
}

function MakeSelection(Left,Top,Right,Bottom){
var selRegion = Array(
Array(Left, Top),
Array(Right, Top),
Array(Right, Bottom),
Array(Left, Bottom),
Array(Left, Top)
);
activeDocument.selection.select(selRegion);
activeDocument.paste();
activeDocument.selection.deselect();
}
TK
Toobi-Won Kenobi
Jun 5, 2008
Hello Paul,

Very neat!
I found that after resizing the image to 300×225 it helped if a white stroke was applied to the image to aid trimming/cutting.
I’m going to have a play with it now and try it with different sizes and resolutions.
Many thanks
TWK

"Paul R" wrote in message
This will do the job in seconds. It will prompt you for the picture. NB: The picture Must be the correct size and resolution 1.5" x 2" @150PPI
#target photoshop
var File1 = File.openDialog("Please select Photo ","*.*"); open(File1);
var doc = activeDocument;
var strtRulerUnits = app.preferences.rulerUnits;
var strtTypeUnits = app.preferences.typeUnits;
app.preferences.rulerUnits = Units.PIXELS;
app.preferences.typeUnits = TypeUnits.PIXELS;
if(doc.width < doc.height) doc.rotateCanvas(90);
if(doc.width ==300 && doc.height == 225){
doc.selection.selectAll();
doc.selection.copy();
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
processPic();
}else{
alert ("Sorry your picture is not 225 pixels x 300 pixels") }
app.preferences.rulerUnits = strtRulerUnits;
app.preferences.typeUnits = strtTypeUnits;

function processPic(){
var doc = app.documents.add(1200, 1800, 150, null, NewDocumentMode.RGB, DocumentFill.WHITE);
MakeSelection(600,675,900,900);
MakeSelection(900,675,1200,900);
MakeSelection(300,675,600,900);
MakeSelection(0,675,300,900);
MakeSelection(900,900,1200,1125);
MakeSelection(600,900,900,1125);
MakeSelection(300,900,600,1125);
MakeSelection(0,900,300,1125);
MakeSelection(900,1125,1200,1350);
MakeSelection(600,1125,900,1350);
MakeSelection(300,1125,600,1350);
MakeSelection(0,1125,300,1350);
MakeSelection(900,1350,1200,1575);
MakeSelection(600,1350,900,1575);
MakeSelection(300,1350,600,1575);
MakeSelection(0,1350,300,1575);
MakeSelection(900,1575,1200,1800);
MakeSelection(600,1575,900,1800);
MakeSelection(300,1575,600,1800);
MakeSelection(0,1575,300,1800);
MakeSelection(900,450,1200,675);
MakeSelection(600,450,900,675);
MakeSelection(300,450,600,675);
MakeSelection(0,450,300,675);
MakeSelection(900,225,1200,450);
MakeSelection(600,225,900,450);
MakeSelection(300,225,600,450);
MakeSelection(0,225,300,450);
MakeSelection(900,0,1200,225);
MakeSelection(600,0,900,225);
MakeSelection(300,0,600,225);
MakeSelection(0,0,300,225);
activeDocument.flatten();
}

function MakeSelection(Left,Top,Right,Bottom){
var selRegion = Array(
Array(Left, Top),
Array(Right, Top),
Array(Right, Bottom),
Array(Left, Bottom),
Array(Left, Top)
);
activeDocument.selection.select(selRegion);
activeDocument.paste();
activeDocument.selection.deselect();
}
PR
Paul_R
Jun 6, 2008
Passport Photos are 35mm x 45mm in the UK so here is another script Crop picture using 35mm x 45mm @ 300ppi
Save picture and then run script.
This will create a 6"x4" with 8 pictures with white borders and crop marks.

#target photoshop
var File1 = File.openDialog("Please select Photo ","*.*"); open(File1);
var doc = activeDocument;
var strtRulerUnits = app.preferences.rulerUnits;
var strtTypeUnits = app.preferences.typeUnits;
app.preferences.rulerUnits = Units.PIXELS;
app.preferences.typeUnits = TypeUnits.PIXELS;

if(doc.width > doc.height) doc.rotateCanvas(90);
if (doc.resolution != 300) activeDocument.resizeImage(undefined, undefined, 300, ResampleMethod.NONE);
if(doc.width ==413 && doc.height == 531){
app.activeDocument.resizeCanvas(450, 600, AnchorPosition.MIDDLECENTER); cropMarks();
doc.selection.selectAll();
doc.selection.copy();
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
processPic();
}else{
alert ("Sorry your picture is not 413 pixels x 531 pixels") }
app.preferences.rulerUnits = strtRulerUnits;
app.preferences.typeUnits = strtTypeUnits;

function processPic(){
var doc = app.documents.add(1800, 1200, 300, null, NewDocumentMode.RGB, DocumentFill.WHITE);
MakeSelection(1350,600,1800,1200);
MakeSelection(900,600,1350,1200);
MakeSelection(450,600,900,1200);
MakeSelection(0,600,450,1200);
MakeSelection(1350,0,1800,600);
MakeSelection(900,0,1350,600);
MakeSelection(450,0,900,600);
MakeSelection(0,0,450,600);
activeDocument.flatten();
}

function MakeSelection(Left,Top,Right,Bottom){
var selRegion = Array(
Array(Left, Top),
Array(Right, Top),
Array(Right, Bottom),
Array(Left, Bottom),
Array(Left, Top)
);
activeDocument.selection.select(selRegion);
activeDocument.paste();
activeDocument.selection.deselect();
}
function cropMarks(){
var Width = doc.width;
var Height = doc.height;
var HalfInch = doc.resolution/2;

selectSingleLine(0,0,1,HalfInch);
Stroke();
selectSingleLine(0,Width-(HalfInch),1,Width);
Stroke();
selectSingleLine(Height-1,0,Height,HalfInch);
Stroke();
selectSingleLine(Height-1,Width-HalfInch,Height,Width);
Stroke();
selectSingleLine(0,0,HalfInch,1);
Stroke();
selectSingleLine(Height-HalfInch,0,Height,1);
Stroke();
selectSingleLine(Height-HalfInch,Width-1,Height,Width);
Stroke();
selectSingleLine(0,Width-1,HalfInch,Width);
Stroke();
}
function Stroke(){
var Black = new SolidColor;
Black.rgb.hexValue = ‘000000’;
activeDocument.selection.stroke(Black,1);
activeDocument.selection.deselect();
}
function selectSingleLine(Top,Left,Bottom,Right) {
function cTID(s) { return app.charIDToTypeID(s); };
function sTID(s) { return app.stringIDToTypeID(s); };
var desc11 = new ActionDescriptor();
var ref6 = new ActionReference();
ref6.putProperty( cTID(‘Chnl’), cTID(‘fsel’) );
desc11.putReference( cTID(‘null’), ref6 );
var desc12 = new ActionDescriptor();
desc12.putUnitDouble( cTID(‘Top ‘), cTID(‘#Pxl’), Top ); desc12.putUnitDouble( cTID(‘Left’), cTID(‘#Pxl’), Left ); desc12.putUnitDouble( cTID(‘Btom’), cTID(‘#Pxl’), Bottom ); desc12.putUnitDouble( cTID(‘Rght’), cTID(‘#Pxl’), Right ); desc11.putObject( cTID(‘T ‘), cTID(‘Rctn’), desc12 );
executeAction( cTID(‘setd’), desc11, DialogModes.NO );
};
TK
Toobi-Won Kenobi
Jun 6, 2008
Paul,

Absolutely fantastic and very useful, you are most kind. I have never done much with scripts but I am now learning a lot about them from "reverse engineering" yours.

Regards
TWK

"Paul R" wrote in message
Passport Photos are 35mm x 45mm in the UK so here is another script Crop picture using 35mm x 45mm @ 300ppi
Save picture and then run script.
This will create a 6"x4" with 8 pictures with white borders and crop marks.

#target photoshop
var File1 = File.openDialog("Please select Photo ","*.*"); open(File1);
var doc = activeDocument;
var strtRulerUnits = app.preferences.rulerUnits;
var strtTypeUnits = app.preferences.typeUnits;
app.preferences.rulerUnits = Units.PIXELS;
app.preferences.typeUnits = TypeUnits.PIXELS;

if(doc.width > doc.height) doc.rotateCanvas(90);
if (doc.resolution != 300) activeDocument.resizeImage(undefined, undefined, 300, ResampleMethod.NONE);
if(doc.width ==413 && doc.height == 531){
app.activeDocument.resizeCanvas(450, 600, AnchorPosition.MIDDLECENTER); cropMarks();
doc.selection.selectAll();
doc.selection.copy();
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
processPic();
}else{
alert ("Sorry your picture is not 413 pixels x 531 pixels") }
app.preferences.rulerUnits = strtRulerUnits;
app.preferences.typeUnits = strtTypeUnits;

function processPic(){
var doc = app.documents.add(1800, 1200, 300, null, NewDocumentMode.RGB, DocumentFill.WHITE);
MakeSelection(1350,600,1800,1200);
MakeSelection(900,600,1350,1200);
MakeSelection(450,600,900,1200);
MakeSelection(0,600,450,1200);
MakeSelection(1350,0,1800,600);
MakeSelection(900,0,1350,600);
MakeSelection(450,0,900,600);
MakeSelection(0,0,450,600);
activeDocument.flatten();
}

function MakeSelection(Left,Top,Right,Bottom){
var selRegion = Array(
Array(Left, Top),
Array(Right, Top),
Array(Right, Bottom),
Array(Left, Bottom),
Array(Left, Top)
);
activeDocument.selection.select(selRegion);
activeDocument.paste();
activeDocument.selection.deselect();
}
function cropMarks(){
var Width = doc.width;
var Height = doc.height;
var HalfInch = doc.resolution/2;

selectSingleLine(0,0,1,HalfInch);
Stroke();
selectSingleLine(0,Width-(HalfInch),1,Width);
Stroke();
selectSingleLine(Height-1,0,Height,HalfInch);
Stroke();
selectSingleLine(Height-1,Width-HalfInch,Height,Width);
Stroke();
selectSingleLine(0,0,HalfInch,1);
Stroke();
selectSingleLine(Height-HalfInch,0,Height,1);
Stroke();
selectSingleLine(Height-HalfInch,Width-1,Height,Width);
Stroke();
selectSingleLine(0,Width-1,HalfInch,Width);
Stroke();
}
function Stroke(){
var Black = new SolidColor;
Black.rgb.hexValue = ‘000000’;
activeDocument.selection.stroke(Black,1);
activeDocument.selection.deselect();
}
function selectSingleLine(Top,Left,Bottom,Right) {
function cTID(s) { return app.charIDToTypeID(s); };
function sTID(s) { return app.stringIDToTypeID(s); };
var desc11 = new ActionDescriptor();
var ref6 = new ActionReference();
ref6.putProperty( cTID(‘Chnl’), cTID(‘fsel’) );
desc11.putReference( cTID(‘null’), ref6 );
var desc12 = new ActionDescriptor();
desc12.putUnitDouble( cTID(‘Top ‘), cTID(‘#Pxl’), Top ); desc12.putUnitDouble( cTID(‘Left’), cTID(‘#Pxl’), Left ); desc12.putUnitDouble( cTID(‘Btom’), cTID(‘#Pxl’), Bottom ); desc12.putUnitDouble( cTID(‘Rght’), cTID(‘#Pxl’), Right ); desc11.putObject( cTID(‘T ‘), cTID(‘Rctn’), desc12 );
executeAction( cTID(‘setd’), desc11, DialogModes.NO );
};

How to Improve Photoshop Performance

Learn how to optimize Photoshop for maximum speed, troubleshoot common issues, and keep your projects organized so that you can work faster than ever before!

Related Discussion Topics

Nice and short text about related topics in discussion sections