Script to export selected objects (including grouped) as individual JPEGs at 144dpi
Hi all,
I've found variations of this but nothing that hits the spot quite as I need. We use InDesign to design and mockup web page and email designs and subsequently pass on the image assets to our developers to build a HTML page with. Some times we cheat image backgrounds extensions with subtle stretches and re-group, so I need the group to export exactly how it appears in InDesign but as a single JPEG.
I'd like a shorcut triggered script that exports all selected objects, including grouped ojects, as individual JPEGs at max quality, at a predefined resolution (in this case @15739213, so 144ppi) and be able to define the save location (though straight to Desktop would be good enough).
The below script kind of works but it only exports the groups and breaks the groups down in to individual images.
I'd love to learn how to edit this to achieve what I need. Thanks in advance to any that may be able to help.
test();
function test(){
var myDoc = app.activeDocument;
var myGroups = myDoc.groups;
//for each group...
for (var i = 0;i < myGroups.length; i++){
// for each rectangle in the group...
for(var r = 0; r< myGroups[i].rectangles.length; r++){
var myRect = myGroups[i].rectangles[r];
app.jpegExportPreferences.exportResolution = 144;
app.jpegExportPreferences.jpegQuality = JPEGOptionsQuality.MAXIMUM;
//give it a unique name
var myFile = new File('~/desktop/newJPG' + myRect.id + '.jpg');
myRect.exportFile(ExportFormat.JPG, myFile);
}
}
}
