Skip to main content
Participant
April 28, 2023
Question

issue creating jpeg with cmyk color space on indesign server using InDesign ExtendScript API

  • April 28, 2023
  • 1 reply
  • 270 views

Feature:
I am trying to create a jpeg from a template exported from the indesign desktop app.
The jpeg can have custom preferenences equal to whats available in the JPEGExportPreference class.

Process:
When a user selects cmyk for their preference the JpegColorSpaceEnum.CMYK value is set for the jpegColorSpace property. The updated JPEGExportPreference is then set for the Application. Finally the image using the updated preference is exported using the exportFile method on the Document class


Issue:

The preferences are set for all fields except for jpegColorSpace when JpegColorSpaceEnum.CMYK is used. by default the icc profile that is set for the Application is u.s. web coated (swop) v2. When reading the exif data for the image that is created from the indesing server an rgb icc profile is being set. When the same template and preferences are used in the indesign desktop application the the correct icc profile is set when reading out the exif data.

 

Question:

Since there arent any other steps described in the indesign documentation do you know why I cant set the color space to cmyk for a jpeg image?

This topic has been closed for replies.

1 reply

rob day
Community Expert
Community Expert
April 28, 2023

Hi @Olonnye29641242m05v , Does this code work for you?:

 

 

var doc = app.activeDocument;
var pg=app.activeWindow.activePage.name;
//save the doc‘s CMYK profile
var docCMYK = doc.cmykProfile;
//export profile
var exportCMYK = "U.S. Web Coated (SWOP) v2"

//sets the active document’s profile:
doc.cmykProfile = exportCMYK;

app.jpegExportPreferences.properties = {
    exportResolution:72,
    pageString:pg,
    antiAlias:true,
    embedColorProfile:true,
    jpegColorSpace:JpegColorSpaceEnum.CMYK
    //add other properties as needed
}
 
//export the JPEG
doc.exportFile(ExportFormat.jpg, File(Folder.desktop + "/ExportJPG.jpg"));
//reset profile
doc.cmykProfile = docCMYK;

 

 

The JPEG opened in Photoshop includes the embedded SWOP profile:

 

Participant
April 28, 2023

This works!

I was already using most of the code you listed so the only thing i needed to add to my code was

var exportCMYK = "U.S. Web Coated (SWOP) v2"
doc.cmykProfile = exportCMYK;

 
Thank you for your quick response.