Mobile app version of vmapp.org
Login or Join
Holmes874

: Mass export all images as individual JPEGs in InDesign, but not use image frame ratio I would like to mass export all linked images in a Indesign document using this script, its from this

@Holmes874

Posted in: #AdobeIndesign #Export #IndesignScripting #Jpg #Script

I would like to mass export all linked images in a Indesign document using this script, its from this thread

var myDoc = app.activeDocument,
apis = myDoc.allPageItems, pageItem, fileName;

while ( pageItem = apis.pop() ) {
if ( !pageItem.graphics[0].isValid ){ continue;}

fileName = File ( pageItem.graphics[0].itemLink.filePath ).name;
fileName = fileName.replace( /.[a-z]{2,4}$/i, '.jpg' );

app.jpegExportPreferences.exportResolution = 2400;
app.jpegExportPreferences.jpegQuality = JPEGOptionsQuality.MAXIMUM;

//give it a unique name
var myFile = new File ("C:/Users/RANFacistol-Mata/Desktop/Image Trial/"+ fileName);


pageItem.exportFile(ExportFormat.JPG, myFile);
}


When i use this script, it export the linked images in the ratio how its placed in Indesign.

How its exported


How it looks in Indesign


Yet i want it to look like this, the original ratio of the image

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Holmes874

1 Comments

Sorted by latest first Latest Oldest Best

 

@Hamaas979

You need to export the graphic, not the object.
Add .graphics[0] before the exportFile function.

var myDoc = app.activeDocument,
apis = myDoc.links.everyItem().getElements(),
items, fileName;
var i = 0;
var MyPath = "C:/Users/xx/Desktop/test/"; // change your path here

alert("Script is running. Press OK and wait until done...");

while (items = apis.pop()) {
items = items.parent.parent;
if (!(items.hasOwnProperty("graphics"))) {
continue;
}
i++;
try {
fileName = File(items.graphics[0].itemLink.filePath).name;
fileName = i + "_" + fileName.replace(/.[a-z]{2,4}$/i, '.jpg');
} catch (e) {};

app.jpegExportPreferences.exportResolution = 2400;
app.jpegExportPreferences.jpegQuality = JPEGOptionsQuality.MAXIMUM;

//give it a unique name
var myFile = new File(MyPath + fileName);

items.graphics[0].exportFile(ExportFormat.JPG, myFile);
}

alert("Done");


Edit: Or... package your links and use Photoshop batch function to save everything in JPG

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme