Good morning.
So, I've got a series of indesign documents, all of which contain various different types of placed graphics; eps, png, jpg, ai, psd, and the like.
I know that I can export these graphics from Indesign server, via script, by iterating allGraphics, or, splineItems, just to name a few.
What I noticed, though, is that the exported file is sized to the frame it was placed in. In other words, if I placed a 3000x2000 px jpeg into a 320x240pt box, did some fitting options on it (say, fill Proportionally), then the exported image will be just that, 320x240.
How do I go about exporting these Graphics at full-resolution? IE: I want my exported PNG to be 3000x2000.
Suggestions?
Thanks.
If you placed a 3000 x 2000 px jpeg into InDesign, why not just use that image? Why try to export something new out of InDesign? Even if you are successful, you will typically lose quaity whenever you change the format or resolution of graphics data.
If this is really a display quality issue that you're having, note that the graphics display quality is controlled by View > Display Performance > High Quality Display. And make sure that you haven't lost the links to the original graphics ... see the Window > Links panel.
"An odd way to use ID…" -- That brought a smile to my face. Perhaps, odd, yes, but I've done worse, believe me.
There is a valid reason I have for not doing a collection, and pulling out the orginal assets/Links. I require them to be PNG.
InDesign server does a bang-up job at converting all EPS or AI or PSD files into PNG when I ask it to, but, it does so at a cost: It shrinks the exported/converted files to fit the size of their containing frames. Poo.
Here's a snipperoo of what I'm doing. Perhaps someone else has done the same, and figured out the full-size problem I'm facing.
This is part of a larger script, I've trimmed fat for brevity
(function(){
var graphicExportDir = new Folder(source.path+"/graphics");
graphicExportDir.exists||graphicExportDir.create();
d.allGraphics.each(function(graphic){
// Can I do something, here, to get my pal InDesign server to export at full-res?
graphic.exportFile(ExportFormat.PNG_FORMAT, File(graphicExportDir+"/"+graphic.itemLink.name+".png"));
})
})();
> ..converting all EPS or AI or PSD files into PNG when I ask it to ..
You are NOT asking that from InDesign. You are asking it to export "any object" to a PNG. ID simply renders the object at screen resolution and exports that. It has nothing to do with 'original' rez (which, as has been noted, is a meaningless concept for an EPS and AI anyway).
Exporting as PNG is not limited to images; you can export anything as a PNG, from a single line and a text frame up to an entire page.
It appears you are attempting to use ID to "convert" your images to PNG format -- well, there are lots of better programs for that -- and it's easier as well, up to and including setting its resolution. Photoshop can save PSD images as PNG at "their native resolution" when asked; for EPS and AI you can use Save For Web in Illustrator, and then you have to decide what its "native resolution" would be.
Yes, I have some other apps at my disposal, namely, ImageMagick. However, I don't want to use it. Notice the choice of words, "Want". I 'want' to do all my image processing on the indesign server.
Anyway, I found a solution, which works perfectly.
This is from a basic testcase, but obviously the code can be cleaned up.
d.allGraphics.each(function(graphic){
var path = graphic.itemLink.filePath;
var parent = graphic.parent;
try {
graphic.remove();
parent.clearFrameFittingOptions();
parent.place(File(path));
parent.fit(FitOptions.FRAME_TO_CONTENT);
parent.graphics[0].exportFile(ExportFormat.PNG_FORMAT, File(gf+"/"+parent.graphics[0].itemLink.name+".png"));
} catch (error){
alert("drink a beer.");
}
});
North America
Europe, Middle East and Africa
Asia Pacific