• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

Explorer ,
Mar 17, 2022 Mar 17, 2022

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:
1.png2.png


TOPICS
Actions and scripting , Windows

Views

547

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Guide , Mar 17, 2022 Mar 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);
...

Votes

Translate

Translate
Explorer , Mar 21, 2022 Mar 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.embedColorPro
...

Votes

Translate

Translate
Adobe
Guide ,
Mar 17, 2022 Mar 17, 2022

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 21, 2022 Mar 21, 2022

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)

.  

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Mar 22, 2022 Mar 22, 2022

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 22, 2022 Mar 22, 2022

Copy link to clipboard

Copied

LATEST

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. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 18, 2022 Mar 18, 2022

Copy link to clipboard

Copied

@AJJ22656695e0lw 

 

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines