Copy link to clipboard
Copied
Saving a file as eps in photoshop produces a file that's about 23,000kb. When using a script it produces a 850,000kb file.
File description:
The file is about 11k x 15k pixels, includes about 115 layers and 110 linked files.
I've looked around stackoverflow, adobe, scripting reference, other forums etc and can't figure out what eps saveoption needs to be used. Is there an easy fix to get the file size wayyy down?
Script:
#target photoshop
var psdpath = activeDocument.path.fsName; // full path
var parentdirectory = activeDocument.path.name; // folder name of file
// doing stuff here before saving...
// Saving
function SaveEPS (saveFile) {
epsSaveOpts = new EPSSaveOptions();
// These have all been tried:
// epsSaveOpts.embedColorProfile = true;
// epsSaveOpts.flattenOuput = true;
// epsSaveOpts.includeDocumentThumbnails = false;
// epsSaveOpts.saveEncoding = JPGMAXIMUM;
// epsSaveOpts.preview = false;
// epsSaveOpts.includeDocumentThumbnails = false;
activeDocument.saveAs(saveFile, epsSaveOpts, true, Extension.LOWERCASE);
}
saveName = File (psdpath+"/"+parentdirectory+" - suffix.eps");
SaveEPS (saveName);
How it's saved manually:
#target photoshop
var psdpath = activeDocument.path.fsName; // full path
var parentdirectory = activeDocument.path.name; // folder name of file
// doing stuff here before saving...
// Saving
function SaveEPS(saveFile) {
var s2t = stringIDToTypeID;
(d = new ActionDescriptor()).putEnumerated(s2t('encoding'), s2t('encoding'), s2t('JPEG'));
d.putEnumerated(s2t('quality'), s2t('quality'), s2t('maximum'));
d.putBoolean(s2t('halftoneScreen'), false);
d.putBoolean(s2t('transferFunction'), false);
...
Thank you. Is there a reason you didn't just do this?(see below. I figured out my syntax was just wrong for SaveEncoding).
Is stringIDToTypeID just more flexible so it's your default method? also did you get those values via a listener?
#target photoshop
var psdpath = activeDocument.path.fsName;
var parentdirectory = activeDocument.path.name;
//doing stuff here before saving...
//saving
function SaveEPS (saveFile) {
epsSaveOpts = new EPSSaveOptions();
epsSaveOpts.embedColorPro
...
Copy link to clipboard
Copied
#target photoshop
var psdpath = activeDocument.path.fsName; // full path
var parentdirectory = activeDocument.path.name; // folder name of file
// doing stuff here before saving...
// Saving
function SaveEPS(saveFile) {
var s2t = stringIDToTypeID;
(d = new ActionDescriptor()).putEnumerated(s2t('encoding'), s2t('encoding'), s2t('JPEG'));
d.putEnumerated(s2t('quality'), s2t('quality'), s2t('maximum'));
d.putBoolean(s2t('halftoneScreen'), false);
d.putBoolean(s2t('transferFunction'), false);
d.putBoolean(s2t('colorManagement'), true);
d.putBoolean(s2t('interpolation'), false);
(desc = new ActionDescriptor()).putObject(s2t('as'), s2t('photoshopEPSFormat'), d);
desc.putPath(s2t('in'), saveFile);
executeAction(s2t('save'), desc, DialogModes.NO);
}
saveName = File(psdpath + '/' + parentdirectory + ' - suffix.eps');
SaveEPS(saveName);
Copy link to clipboard
Copied
Thank you. Is there a reason you didn't just do this?(see below. I figured out my syntax was just wrong for SaveEncoding).
Is stringIDToTypeID just more flexible so it's your default method? also did you get those values via a listener?
#target photoshop
var psdpath = activeDocument.path.fsName;
var parentdirectory = activeDocument.path.name;
//doing stuff here before saving...
//saving
function SaveEPS (saveFile) {
epsSaveOpts = new EPSSaveOptions();
epsSaveOpts.embedColorProfile = true;
epsSaveOpts.flattenOuput = true;
epsSaveOpts.includeDocumentThumbnails = false;
epsSaveOpts.encoding = SaveEncoding.JPEGMAXIMUM; //syntax was wrong on this
activeDocument.saveAs(saveFile, epsSaveOpts, true, Extension.LOWERCASE);
}
saveName = File (psdpath+"/"+parentdirectory+"-- suffix.eps");
SaveEPS (saveName);
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES)
.
Copy link to clipboard
Copied
Yes, I got this data from listener. I like this kind of code because it does not use DOM model constants, i.e. all variables are represented directly by their values. In addition, by listening to events, we get the most accurate description of the object that initiated them (that is, we immediately get an understanding of which variables are needed in order to repeat the result exactly).
Copy link to clipboard
Copied
Thanks for contributing. That makes sense. I'll take your sample code and play with it.
For anyone reading (just saw this): "Where the DOM is missing, ActionManager (AM) code fills the gaps."
I will follow steps here to get the listener (ScriptingListener plug-in). if this is not the right listener please let me know.
Copy link to clipboard
Copied