Powered by Invision Power Board


 

>  Photoshop - , landscape\portrait
Mentat
Aug 12 2012, 03:25 PM




Administrator
***


: Admin
: 2009
: 133
: 5-February 04






#target photoshop
//
// resize_vaariation.jsx
//

cTID = function(s) { return app.charIDToTypeID(s); };
sTID = function(s) { return app.stringIDToTypeID(s); };

// Target Size in pixels
mTargetSize = 1200;

// Flatten Image
function step1() {
executeAction(sTID('flattenImage'), undefined, DialogModes.NO);
};

// Duplicate
function step2() {
var desc1 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putEnumerated(cTID('Dcmn'), cTID('Ordn'), cTID('Frst'));
desc1.putReference(cTID('null'), ref1);
executeAction(cTID('Dplc'), desc1, DialogModes.NO);
};

// Image Size
function step3() {
var desc1 = new ActionDescriptor();
if (mLandscape == 0)
{
desc1.putUnitDouble(cTID('Hght'), cTID('#Pxl'), mTargetSize);
} else
{
desc1.putUnitDouble(cTID('Wdth'), cTID('#Pxl'), mTargetSize);
}
desc1.putBoolean(sTID("scaleStyles"), true);
desc1.putBoolean(cTID('CnsP'), true);
desc1.putEnumerated(cTID('Intr'), cTID('Intp'), cTID('Bcbc'));
executeAction(sTID('imageSize'), desc1, DialogModes.NO);
};

// Set
function step4() {
var desc1 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putProperty(cTID('Chnl'), sTID("selection"));
desc1.putReference(cTID('null'), ref1);
desc1.putEnumerated(cTID('T '), cTID('Ordn'), cTID('Al '));
executeAction(cTID('setd'), desc1, DialogModes.NO);
};

// Copy
function step5() {
executeAction(cTID('copy'), undefined, DialogModes.NO);
};

// Close
function step6() {
var desc1 = new ActionDescriptor();
desc1.putEnumerated(cTID('Svng'), cTID('YsN '), cTID('N '));
executeAction(cTID('Cls '), desc1, DialogModes.NO);
};

// Image Size
function step7() {
var desc1 = new ActionDescriptor();
if (mLandscape == 0)
{
desc1.putUnitDouble(cTID('Hght'), cTID('#Pxl'), mTargetSize);
} else
{
desc1.putUnitDouble(cTID('Wdth'), cTID('#Pxl'), mTargetSize);
}
desc1.putBoolean(sTID("scaleStyles"), true);
desc1.putBoolean(cTID('CnsP'), true);
desc1.putEnumerated(cTID('Intr'), cTID('Intp'), cTID('Nrst'));
executeAction(sTID('imageSize'), desc1, DialogModes.NO);
};

// Paste
function step8() {
var desc1 = new ActionDescriptor();
desc1.putEnumerated(cTID('AntA'), cTID('Annt'), cTID('Anno'));
executeAction(cTID('past'), desc1, DialogModes.NO);
};

// Set
function step9() {
var desc1 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putEnumerated(cTID('Lyr '), cTID('Ordn'), cTID('Trgt'));
desc1.putReference(cTID('null'), ref1);
var desc2 = new ActionDescriptor();
desc2.putUnitDouble(cTID('Opct'), cTID('#Prc'), 60);
var desc3 = new ActionDescriptor();
desc3.putUnitDouble(cTID('Scl '), cTID('#Prc'), 333.333333333333);
desc2.putObject(cTID('Lefx'), cTID('Lefx'), desc3);
desc1.putObject(cTID('T '), cTID('Lyr '), desc2);
executeAction(cTID('setd'), desc1, DialogModes.NO);
};

// Merge Layers
function step10() {
var desc1 = new ActionDescriptor();
executeAction(sTID('mergeLayersNew'), desc1, DialogModes.NO);
};

// Duplicate
function step11() {
var desc1 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putEnumerated(cTID('Lyr '), cTID('Ordn'), cTID('Trgt'));
desc1.putReference(cTID('null'), ref1);
desc1.putInteger(cTID('Vrsn'), 5);
executeAction(cTID('Dplc'), desc1, DialogModes.NO);
};

// Unsharp Mask
function step12() {
var desc1 = new ActionDescriptor();
desc1.putUnitDouble(cTID('Amnt'), cTID('#Prc'), 100);
desc1.putUnitDouble(cTID('Rds '), cTID('#Pxl'), 0.3);
desc1.putInteger(cTID('Thsh'), 0);
executeAction(sTID('unsharpMask'), desc1, DialogModes.NO);
};

// Set
function step13() {
var desc1 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putEnumerated(cTID('Lyr '), cTID('Ordn'), cTID('Trgt'));
desc1.putReference(cTID('null'), ref1);
var desc2 = new ActionDescriptor();
var list1 = new ActionList();
var desc3 = new ActionDescriptor();
var ref2 = new ActionReference();
ref2.putEnumerated(cTID('Chnl'), cTID('Chnl'), cTID('Gry '));
desc3.putReference(cTID('Chnl'), ref2);
desc3.putInteger(cTID('SrcB'), 17);
desc3.putInteger(cTID('Srcl'), 70);
desc3.putInteger(cTID('SrcW'), 158);
desc3.putInteger(cTID('Srcm'), 217);
desc3.putInteger(cTID('DstB'), 0);
desc3.putInteger(cTID('Dstl'), 0);
desc3.putInteger(cTID('DstW'), 255);
desc3.putInteger(cTID('Dstt'), 255);
list1.putObject(cTID('Blnd'), desc3);
desc2.putList(cTID('Blnd'), list1);
var desc4 = new ActionDescriptor();
desc4.putUnitDouble(cTID('Scl '), cTID('#Prc'), 333.333333333333);
desc2.putObject(cTID('Lefx'), cTID('Lefx'), desc4);
desc1.putObject(cTID('T '), cTID('Lyr '), desc2);
executeAction(cTID('setd'), desc1, DialogModes.NO);
};

// Merge Layers
function step14() {
var desc1 = new ActionDescriptor();
executeAction(sTID('mergeLayersNew'), desc1, DialogModes.NO);
};



if (documents.length > 0)
{
docRef = activeDocument;

displayDialogs = DialogModes.NO;

var strtRulerUnits = preferences.rulerUnits;
preferences.rulerUnits = Units.CM;

if (docRef.width > docRef.height)
// Landscape
{
// alert("Landscape");
mLandscape = 1;
}
else
// Portret
{
// alert("Portrait");
mLandscape = 0;
}
step1(); // Flatten Image
step2(); // Duplicate
step3(); // Image Size
step4(); // Set
step5(); // Copy
step6(); // Close
step7(); // Image Size
step8(); // Paste
step9(); // Set
step10(); // Merge Layers
step11(); // Duplicate
step12(); // Unsharp Mask
step13(); // Set
step14(); // Merge Layers

preferences.rulerUnits = strtRulerUnits;

}
else
{
alert("There must be at least one open document.");
}
"resize_vaariation.jsx"
// EOF

PM
Top
0 (0 0 )
0 :
« | | »