Skip to main content
Inspiring
March 17, 2022
Answered

Photoshop script save as eps producing large file (EPSSaveOptions question)

  • March 17, 2022
  • 2 replies
  • 840 views

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:



This topic has been closed for replies.
Correct answer AJJ22656695e0lw

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)

.  

2 replies

Stephen Marsh
Community Expert
Community Expert
March 19, 2022

@AJJ22656695e0lw 

 

How did the script from jazz-y work for you?

Legend
March 17, 2022

 

#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);
AJJ22656695e0lwAuthorCorrect answer
Inspiring
March 21, 2022

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)

.  

Legend
March 22, 2022

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).