Link in Zwischenablage kopieren
Kopiert
Hi all,
I have a simple question. Is it possible to export to PNG in InDesign? Right now, I've been doing a copy-paste into Illustrator, then saving it as PNG from there. Is there a better way to do this?
Trish
InDesign CS4 | PC
InDesign can now export to PNG from File>Export and pick the file format.
Link in Zwischenablage kopieren
Kopiert
No version of InDesign can export to PNG. But there is a much better way than copy/paste into Illustrator. Export a PDF then save that as PNG from Acrobat or rasterize in Photoshop and save as PNG from Photoshop.
Link in Zwischenablage kopieren
Kopiert
Oddly enough, that's not .. entirely .. true.
The CS4 scripting help lists "PNG Format" amongst its possible export formats. A quick test
app.activeDocument.selection[0].exportFile(ExportFormat.PNG_FORMAT, File(new File("c:\\test.png")));
shows CS4 can export to PNG. However, there are no settings to change, which limits its usefulness.
Link in Zwischenablage kopieren
Kopiert
Interesting. I'm actually very interested in PNG export from InDesign. It seems like that would be the ideal way for me to get what I need. I've explored as many other options as I can think of, all of which are sort of crummy. Here's what I've tried so far:
My document is composed of 35 pages, which represent 7 zoom levels for the 5 floor maps of my building. The floor maps are made in Illustrator and "placed" into master-pages. Indesign handles all of the text overlays for the maps. It's better than Illustrator for this because of the ability to create paragraph and character styles that are global.
So that's the processes I've tried. Can anyone think of more I can try? The ulitmate goal is to have each page in InDesign export to a translucent backed image format, which I can then convert to PNG. TIFF, TGA, or PNG would all equally work. I just want to preserve the position of the content relative to the artboard/page AND preserve the translucency of the content.
I used to export using JPG, but the translucency has become a priority since these images will be stacked on top of other images as tiles on Google Maps.
Thanks for any advice or suggestions anyone can provide.
Link in Zwischenablage kopieren
Kopiert
I feel like there may be some real problems with this workflow...does anyone know how InDesign compresses PNG files in exported PDFs?
In any event, if you Export to PDF in InDesign, you can open it in Acrobat Professional, and then File > Save As > Image... > PNG and it will save one file for each page of your document.
(If you have a complex question that's not the same as an old question, you're usually better off starting a new thread...)
Link in Zwischenablage kopieren
Kopiert
Thanks John. My post got longer than I originally expected. Otherwise I would have just made a new thread.
I feel like I should clarify my original post that you replied to. That list of processes isn't one sequence of actions to get a final product. It lists every seperate method I've tried (unsuccessfully) to get usable images out of InDesign. I'm not doing them all in sequence. That would be a real workflow issue.
Saving PDFs from Acrobat doesn't give you translucent PNGs, because of the white paper background it assumes; even if you didn't have a background set in InDesign. I tried that too and was disappointed. Also, there's no way to "delete" the paper/page/white-background in Acrobat Pro before saving as PNG.
Link in Zwischenablage kopieren
Kopiert
Also, there's no way to "delete" the paper/page/white-background in Acrobat Pro before saving as PNG.
When you export the PDF from ID make sure it includes live transparency (i.e., PDF/X-4 and not PDF/X-1a), then the document's page background will be transparent when you open it into Photoshop.
Saving pages out to PNGs is scriptable—I have an AppleScript that would work if you’re using OSX. I'm not sure why a PDF page would take minutes to open unless you are asking for huge res—my script opens a page at 300 ppi in a few seconds.
Link in Zwischenablage kopieren
Kopiert
Oh that's perfect! That's exactly the type of advice I was hoping for! I never knew what the significant differences were between those PDF/X-x formats. I was able to export my InDesign document as a PDF and successfully open the translucent pages in Photoshop.
I actually only have CS5 for Windows here at work, (and a copy of CS3 on my personal Mac) but am a Programmer and am familiar with AppleScript, so If you'd be willing to share, I'd love to get ahold of your script. If it just can't work with Photoshop as old as CS3, I'm sure I can create a Windows equivilant.
There must have been something wrong when I tried importing the PDF earlier. This X-4 opened very quickly and came with a convenient resolution and page selection dialog.
Much appreciated! Thanks.
Link in Zwischenablage kopieren
Kopiert
This is for CS5, but probably works back to CS3. Shows a dialog for choosing resolution and anti aliasing, asks for a destination folder, and writes the pdf and pngs to that folder.
http://www.zenodesign.com/forum/IDpagestoPNG.zip
Link in Zwischenablage kopieren
Kopiert
I couldn't get the script to work on CS4.
I dropped it into the applescript folder in Scripts > Scripts Panel > Samples > AppleScript.
Here's a screen shot of the export options:
Would love to export to PNG, but the Acrobat workaround might have to do the job for now.
Link in Zwischenablage kopieren
Kopiert
After you've dumped it in there you go to the scripts panel to run it. You'll find it under Samples, I prefer to open the scripts panel first, right click where I want to put it and choose Reveal in... That opens up a window to paste it into.
Link in Zwischenablage kopieren
Kopiert
Cheers Stix. Must admit, I've never noticed the scripts panel before, worked a treat.
Link in Zwischenablage kopieren
Kopiert
Link in Zwischenablage kopieren
Kopiert
Heres a solution for exporting pages (cropped or the whole page) or a selection.
Beware the script saves the file first and reverts to the saved version when done.
#target InDesign
//DESCRIPTION: Export PNG
/*
Author: Philipp Lehmann
Datum: 2013-07-17
*/
var column_left = 150;
var column_center_big = 140;
var column_center_small = 60;
var column_right = 210;
var column_right_text = 200;
var myDoc;
var myAssetName;
if (app.documents.length > 0) {
var userLevel = app.scriptPreferences.userInteractionLevel;
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;
var _version = app.scriptPreferences.version;
var myDoc = app.activeDocument;
/*var hMUnits = myDoc.viewPreferences.horizontalMeasurementUnits;
myDoc.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.MILLIMETERS;
var VMUnits = myDoc.viewPreferences.verticalMeasurementUnits;
myDoc.viewPreferences.verticalMeasurementUnits = MeasurementUnits.MILLIMETERS;
var rulerOrigin = myDoc.viewPreferences.rulerOrigin;
myDoc.viewPreferences.rulerOrigin = RulerOrigin.PAGE_ORIGIN
var zeroPoint = myDoc.zeroPoint;
myDoc.zeroPoint = [0,0]
var tRPoint = myDoc.layoutWindows[0].transformReferencePoint;
myDoc.layoutWindows[0].transformReferencePoint = AnchorPoint.TOP_LEFT_ANCHOR;*/
try {
main ();
} catch (e) {
alert("An error occured at:\n" + e +
"\nLine: " + e.line +
"\nScript: " + e.fileName );
}
app.scriptPreferences.userInteractionLevel = userLevel;
/*app.scriptPreferences.version = _version
myDoc.viewPreferences.horizontalMeasurementUnits = hMUnits;
myDoc.viewPreferences.verticalMeasurementUnits = VMUnits;
myDoc.viewPreferences.rulerOrigin = rulerOrigin;
myDoc.zeroPoint = zeroPoint;
myDoc.layoutWindows[0].transformReferencePoint = tRPoint;*/
} else {
alert ("No document");
}
function main(){
// Save document and open the dialog
myDoc.save();
//Make certain that user interaction (display of dialogs, etc.) is turned on.
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
myAssetName = (myDoc.name.replace(".indd"," "));
myExportDialog();
}
function myExportDialog(){
with(myDialog = app.dialogs.add({name:"Export PNG"})){
//Add dialog labels in three columns
myDialogColumn = dialogColumns.add()
/*with(myDialogColumn){
with(borderPanels.add()){
staticTexts.add({staticLabel:"Transparent Images:", minWidth: column_left});
with(myExportFormatButtons = radiobuttonGroups.add()){
radiobuttonControls.add({staticLabel:"Yes", checkedState:true, minWidth: column_right});
radiobuttonControls.add({staticLabel:"No", minWidth: column_right});
}
with (myPageSelection = dialogColumns.add() ) {
}
}
}*/
with(myDialogColumn){
with(borderPanels.add()){
staticTexts.add({staticLabel:"Crop Image:", minWidth: column_left});
with(myCropButtons = radiobuttonGroups.add()){
radiobuttonControls.add({staticLabel:"No", checkedState:true, minWidth: column_right});
radiobuttonControls.add({staticLabel:"Yes", minWidth: column_right});
}
with (myPageSelection = dialogColumns.add() ) {
}
}
}
with(myDialogColumn){
with(borderPanels.add()){
with (dialogColumns.add() ) {
staticTexts.add({staticLabel:"Export area", minWidth: column_left});
}
with (dialogColumns.add() ) {
with(myPageOptionButtons = radiobuttonGroups.add()){
radiobuttonControls.add({staticLabel:"Custom Pages", minWidth: column_center_big});
radiobuttonControls.add({staticLabel:"All Pages", checkedState:true, minWidth: column_center_big});
radiobuttonControls.add({staticLabel:"Export Selection", minWidth: column_center_big});
}
with (myPageSetting = dialogColumns.add() ) {
var myPageSelectionTextfield = textEditboxes.add({editContents: "", minWidth: column_center_small});
}
}
}
}
with(myDialogColumn){
with(borderPanels.add()){
with (dialogColumns.add() ) {
staticTexts.add({staticLabel:"Filename / Prefix", minWidth: column_left});
}
with (dialogColumns.add() ) {
with (myFileSetting = dialogColumns.add() ) {
var myFilenameTextfield = textEditboxes.add({editContents: myAssetName, minWidth: column_right_text});
}
}
}
}
myReturn = myDialog.show();
if (myReturn == true){
//Get the values from the dialog box.
//myExportFormat = myExportFormatButtons.selectedButton;
myCropOptions = myCropButtons.selectedButton;
myPageOptions = myPageOptionButtons.selectedButton;
myPageSelection = myPageSelectionTextfield.editContents;
myFilename = myFilenameTextfield.editContents;
myFolder = Folder.selectDialog ("Choose Destination Folder");
if(myFolder != null){
applyOptions();
}
} else{
myDialog.destroy();
}
}
}
// Call Export function for the corresponding pages.
function applyOptions() {
var myFile = new File(myFolder);
switch(myPageOptions) {
case 0:
// Export single Pages for comma separated values.
if ( myPageSelection.match(',') == "," ) {
var mp = myPageSelection.split(",");
for (i=0; i < mp.length; i++) {
if ( parseInt(mp) <= app.activeDocument.pages.length) {
exportPage(parseInt(mp) - 1);
} else {
alert("Invalid page selection");
}
}
success();
} else {
if ( parseInt(myPageSelection) <= app.activeDocument.pages.length) {
exportPage(myPageSelection - 1);
success();
} else {
alert("Invalid page selection");
}
}
break;
case 1:
// Export all Pages
for (i=0; i<app.activeDocument.pages.length; i++) {
exportPage(i);
}
success();
break;
case 2:
// Export selection
exportSelection();
success();
break;
default:
alert("How did you do that");
}
}
// Apply crop and transparency options and save the PNG-Files
function exportPage(pg) {
page = app.activeDocument.pages[pg];
for (mas=0; mas < page.appliedMaster.pageItems.length; mas++)
try {
page.appliedMaster.pageItems[mas].override(app.activeDocument.pages[pg]);
} catch (bah) { }
if(myCropOptions == 1) {
var myDoc = app.activeDocument;
var bounds = new Array();
bounds[0] = 0;
bounds[1] = 0;
bounds[2] = myDoc.documentPreferences.pageHeight;
bounds[3] = myDoc.documentPreferences.pageWidth;
// Rectangle fit to Page
r = page.rectangles.add({geometricBounds: bounds, strokeWeight: 0, fillColor: "None"});
}
g = page.groups.add(page.pageItems);
// app.hostObjectDelegate.pngExportPreferences.transparentBackground = true;
g.exportFile(ExportFormat.PNG_FORMAT, File(myFolder+"/"+myFilename+(page.name)+".png"));
g.ungroup();
if(myCropOptions == 1) {
r.remove();
}
}
function exportSelection() {
if (app.selection.length == 1) {
g = app.selection[0];
g.exportFile(ExportFormat.PNG_FORMAT, File(myFolder+"/"+myFilename+".png"));
success();
} else if (app.selection.length > 1) {
var myObj = new Array;
myObj = app.selection;
g = app.activeWindow.activePage.groups.add(myObj);
g.exportFile(ExportFormat.PNG_FORMAT, File(myFolder+"/"+myFilename+".png"));
g.ungroup();
success();
} else {
alert("Please select at least one object");
}
}
function success() {
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.neverInteract;
try{
myDoc.revert();
} catch(error) {}
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
}
Link in Zwischenablage kopieren
Kopiert
If you're using a workflow like version 3 (open each page one at a time in Photoshop...), that's like a workflow I use every other month. If you drag the entire multi-page PDF file onto your Photoshop icon, you can tell it to open all of the pages at x resolution in y color space, and then go get some coffee -- when you get back, they're all open, stacked in order with page 1 on top, and you can flatten and save them all as PNG files pretty quickly. And if you do it often, I'm sure you can create some kind of script to do it. Scripts wouldn't help in my case, so I haven't looked into it.
Link in Zwischenablage kopieren
Kopiert
You could certinly create an action that could be used to batch convert the open files....
Link in Zwischenablage kopieren
Kopiert
Where's y'all imagination?
This is a Quick-and-So-Very-Dirty-Dirty-Dirty javascript with lots of traps and pitfalls; still, it works as a Proof Of Concept to do the dirty thang straight out of InDesign.
(In particular I cannot stress enough: Do Not Use On Your Live Document. Save a copy first, because this script messes up your document, and if good old trusty InDesign chooses to crash while running the script, this Messed Up Version will be saved as "current one"!!)
//DESCRIPTION:Export all pages to PNGs -- Do Not Use For Production Purposes
// A Move Along, Nothing to See Here Production
for (pg=0; pg<app.activeDocument.pages.length; pg++)
{
page = app.activeDocument.pages[pg];
for (mas=0; mas < page.appliedMaster.pageItems.length; mas++)
try {
page.appliedMaster.pageItems[mas].override(app.activeDocument.pages[pg]);
} catch (bah) { }
g = page.groups.add(page.pageItems);
g.exportFile(ExportFormat.PNG_FORMAT, File(Folder.myDocuments.fsName+"/"+(page.name)+".png"));
}
Link in Zwischenablage kopieren
Kopiert
This is a Quick-and-So-Very-Dirty-Dirty-Dirty javascript
I haven't try your code but does JavaScript give you access to a PNG export format that isn't available with the UI? I'm not seeing it in the AppleScript dictionary.
Link in Zwischenablage kopieren
Kopiert
Rob, you know your identity has converted to doppelgangerland? See Why has my account spawned a similar identity?
Anyhow, yes, Javascript does. Note that the applescript dictionary doesn't appear to actually have the types enumerated, there's just a text string about them (that also gets offered as an error). So you can do this:
tell application "Adobe InDesign CS5" to export first group of active document format "PNG" to "path:to:mine.png"
and it works fine.
Link in Zwischenablage kopieren
Kopiert
Cool—too bad it only works for page items and not pages.
Rob, you know your identity has converted to doppelgangerland?
Had that happen a few months ago and thought I had fixed it—can't see it happening from inside my account.
Link in Zwischenablage kopieren
Kopiert
Doppelganger is now gone. Go figure.
Link in Zwischenablage kopieren
Kopiert
Hi Scott,
What version of PDF would you recomend exporting to?
Thanks,
George
Link in Zwischenablage kopieren
Kopiert
High Quality Print should be fine. You want transparency and RGB colours preserved.
Link in Zwischenablage kopieren
Kopiert
Thanks for the good info. By the way Scott, how can i be sure to keep RGB features while exporting to PDF? I think the original logo is CMYK, should i choose change colour profile and change output (i don't know if those are the right words in English) but here is the dialog box in Spanish.
Thanks for any input.
By the way, i did a "than copy/paste into Illustrator. Export a PDF then save that as PNG from Acrobat Pro" but the PNG is 4 Kb and even placing a high setting the resolution is very low res. I might be doing something wrong.
Link in Zwischenablage kopieren
Kopiert
Would you use this setting to use the .png for web use as well?
Weitere Inspirationen, Events und Ressourcen finden Sie in der neuen Adobe Community
Jetzt ansehen