Hi guys, I am new here, but was wondering if you could help me please?
I am trying to edit the 'Load files into stack' script as I would like to be able to use this from vector .eps files.
Currently if I load Illustrator .eps files using this method, it defaults the photoshop document size to 72dpi, but I need them to be 300dpi.
This is to enable me to have Quark templates with PSD imported layers, so that I am able to turn each layer on an off in accordance to the logo that I need.
I have figured a workaround, but I need to rasterize the vector file prior to loading into stack, but this just adds more time into the procedure.
Could anyone help me please?
Many thanks
Trev
Load files into stack
Load files into stack
First: The Help Me-Forum would have been a more appropriate place for your post.
Second: You really want to use pixel logos instead of vector logos (and forego the connected quality concerns)?
Third: I would rather not tamper with »Load Files into Stack.jsx«, but it should not be too hard to make a somewhat more simple custom Script for just that purpose if it is needed for only a limited number of file formats.
I probably have overlooked some eventuality, but if you want you could give this a try:
Code: Select all// load files into one rgb-file;
// 2011, use it at your own risk;
#target photoshop
// select files;
if ($.os.search(/windows/i) != -1) {var theFiles = File.openDialog ("please select files", '*.jpg;*.tif;*.eps;*.psd', true)}
else {var theFiles = File.openDialog ("please select files", getFiles, true)};
if (theFiles && theFiles.length > 1) {
// set to pixels;
var originalRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
// new file;
var myDocument = app.documents.add(UnitValue (100, "mm"), UnitValue (100, "mm"), 300, "new", NewDocumentMode.RGB, DocumentFill.TRANSPARENT);
// do the operation;
for (var o = 0; o < theFiles.length; o++) {
var theFile = theFiles[o];
// if generic eps;
if (theFile.name.match(/\.(eps|)$/i) && isGenericEPS(theFile) == true) {
var theLayer = placeEps (theFile);
}
//if pixel image;
else {
var thisFile1 = app.open(File(theFile));
// duplicate image to flatten and get rid of hidden layers;
var thisFile = thisFile1.duplicate("copy", true);
// close original;
if (thisFile1.saved == true) {thisFile1.close(SaveOptions.PROMPTTOSAVECHANGES)};
// rgb;
if (thisFile.mode == DocumentMode.BITMAP) {thisFile.changeMode(ChangeMode.GRAYSCALE)};
if (thisFile.mode != DocumentMode.RGB) {thisFile.changeMode(ChangeMode.RGB)};
if (thisFile.colorProfileName != myDocument.colorProfileName) {thisFile.convertProfile(myDocument.colorProfileName, Intent.RELATIVECOLORIMETRIC, true, true)};
// duplicate layer and close document;
var theLayer = thisFile.layers[0].duplicate(myDocument, ElementPlacement.PLACEATBEGINNING);
thisFile.close(SaveOptions.DONOTSAVECHANGES);
};
theLayer.name = theFile.name
};
// reveal all and trim;
revealAll ();
myDocument.trim();
myDocument.layers[myDocument.layers.length - 1].remove();
// reset;
app.preferences.rulerUnits = originalRulerUnits;
app.activeDocument = myDocument;
// save;
try {
var idsave = charIDToTypeID( "save" );
executeAction( idsave, undefined, DialogModes.ALL );
}
catch (e) {};
};
////////////////////////////////////
////////////////////////////////////
////////////////////////////////////
////// check for generic eps by michael l hale //////
function isGenericEPS(file){
var test = file;
test.open('r');
var str = test.read();
test.close();
var res = str.match('Adobe Photoshop');
return !(!!res);
};
////// get psds, tifs and jpgs from files //////
function getFiles (theFile) {
if (theFile.name.match(/\.(jpg|tif|eps|psd|)$/i)) {
return true
};
};
////// place eps //////
function placeEps (theFile) {
// =======================================================
var idPlc = charIDToTypeID( "Plc " );
var desc3 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
desc3.putPath( idnull, new File( theFile ) );
var idFTcs = charIDToTypeID( "FTcs" );
var idQCSt = charIDToTypeID( "QCSt" );
var idQcsa = charIDToTypeID( "Qcsa" );
desc3.putEnumerated( idFTcs, idQCSt, idQcsa );
var idOfst = charIDToTypeID( "Ofst" );
var desc4 = new ActionDescriptor();
var idHrzn = charIDToTypeID( "Hrzn" );
var idPxl = charIDToTypeID( "#Pxl" );
desc4.putUnitDouble( idHrzn, idPxl, 0.000000 );
var idVrtc = charIDToTypeID( "Vrtc" );
var idPxl = charIDToTypeID( "#Pxl" );
desc4.putUnitDouble( idVrtc, idPxl, 0.000000 );
var idOfst = charIDToTypeID( "Ofst" );
desc3.putObject( idOfst, idOfst, desc4 );
var idAntA = charIDToTypeID( "AntA" );
desc3.putBoolean( idAntA, true );
executeAction( idPlc, desc3, DialogModes.NO );
return app.activeDocument.activeLayer
};
////// reveal all //////
function revealAll () {
var idRvlA = charIDToTypeID( "RvlA" );
executeAction( idRvlA, undefined, DialogModes.NO );
};
Second: You really want to use pixel logos instead of vector logos (and forego the connected quality concerns)?
Third: I would rather not tamper with »Load Files into Stack.jsx«, but it should not be too hard to make a somewhat more simple custom Script for just that purpose if it is needed for only a limited number of file formats.
I probably have overlooked some eventuality, but if you want you could give this a try:
Code: Select all// load files into one rgb-file;
// 2011, use it at your own risk;
#target photoshop
// select files;
if ($.os.search(/windows/i) != -1) {var theFiles = File.openDialog ("please select files", '*.jpg;*.tif;*.eps;*.psd', true)}
else {var theFiles = File.openDialog ("please select files", getFiles, true)};
if (theFiles && theFiles.length > 1) {
// set to pixels;
var originalRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
// new file;
var myDocument = app.documents.add(UnitValue (100, "mm"), UnitValue (100, "mm"), 300, "new", NewDocumentMode.RGB, DocumentFill.TRANSPARENT);
// do the operation;
for (var o = 0; o < theFiles.length; o++) {
var theFile = theFiles[o];
// if generic eps;
if (theFile.name.match(/\.(eps|)$/i) && isGenericEPS(theFile) == true) {
var theLayer = placeEps (theFile);
}
//if pixel image;
else {
var thisFile1 = app.open(File(theFile));
// duplicate image to flatten and get rid of hidden layers;
var thisFile = thisFile1.duplicate("copy", true);
// close original;
if (thisFile1.saved == true) {thisFile1.close(SaveOptions.PROMPTTOSAVECHANGES)};
// rgb;
if (thisFile.mode == DocumentMode.BITMAP) {thisFile.changeMode(ChangeMode.GRAYSCALE)};
if (thisFile.mode != DocumentMode.RGB) {thisFile.changeMode(ChangeMode.RGB)};
if (thisFile.colorProfileName != myDocument.colorProfileName) {thisFile.convertProfile(myDocument.colorProfileName, Intent.RELATIVECOLORIMETRIC, true, true)};
// duplicate layer and close document;
var theLayer = thisFile.layers[0].duplicate(myDocument, ElementPlacement.PLACEATBEGINNING);
thisFile.close(SaveOptions.DONOTSAVECHANGES);
};
theLayer.name = theFile.name
};
// reveal all and trim;
revealAll ();
myDocument.trim();
myDocument.layers[myDocument.layers.length - 1].remove();
// reset;
app.preferences.rulerUnits = originalRulerUnits;
app.activeDocument = myDocument;
// save;
try {
var idsave = charIDToTypeID( "save" );
executeAction( idsave, undefined, DialogModes.ALL );
}
catch (e) {};
};
////////////////////////////////////
////////////////////////////////////
////////////////////////////////////
////// check for generic eps by michael l hale //////
function isGenericEPS(file){
var test = file;
test.open('r');
var str = test.read();
test.close();
var res = str.match('Adobe Photoshop');
return !(!!res);
};
////// get psds, tifs and jpgs from files //////
function getFiles (theFile) {
if (theFile.name.match(/\.(jpg|tif|eps|psd|)$/i)) {
return true
};
};
////// place eps //////
function placeEps (theFile) {
// =======================================================
var idPlc = charIDToTypeID( "Plc " );
var desc3 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
desc3.putPath( idnull, new File( theFile ) );
var idFTcs = charIDToTypeID( "FTcs" );
var idQCSt = charIDToTypeID( "QCSt" );
var idQcsa = charIDToTypeID( "Qcsa" );
desc3.putEnumerated( idFTcs, idQCSt, idQcsa );
var idOfst = charIDToTypeID( "Ofst" );
var desc4 = new ActionDescriptor();
var idHrzn = charIDToTypeID( "Hrzn" );
var idPxl = charIDToTypeID( "#Pxl" );
desc4.putUnitDouble( idHrzn, idPxl, 0.000000 );
var idVrtc = charIDToTypeID( "Vrtc" );
var idPxl = charIDToTypeID( "#Pxl" );
desc4.putUnitDouble( idVrtc, idPxl, 0.000000 );
var idOfst = charIDToTypeID( "Ofst" );
desc3.putObject( idOfst, idOfst, desc4 );
var idAntA = charIDToTypeID( "AntA" );
desc3.putBoolean( idAntA, true );
executeAction( idPlc, desc3, DialogModes.NO );
return app.activeDocument.activeLayer
};
////// reveal all //////
function revealAll () {
var idRvlA = charIDToTypeID( "RvlA" );
executeAction( idRvlA, undefined, DialogModes.NO );
};