Export Layers
Script for Adobe InDesign
Latest update 4/25/2024, version 5.1
Export a separate image or PDF of each layer used on each page of a document.
- Size to page or contents only
- Configure file naming
- Export JPG, PDF (interactive or print), or PNG
- Save and restore all settings
- User-configurable localization
How-to Video
How to use the script
The interface has five sections: Size, File naming, Options, Output, and Settings. Set the desired options and click the OK button to begin. A progress bar is displayed as layers are exported.
Section 1: Size
Page — output size matches the document page size, plus bleed if enabled in the script interface (JPG and PNG) or enabled in the PDF preset used to output print PDFs.
Content — output size matches the boundaries of content that exists on each layer. This can result in output of varying sizes, depending on the design of the layout and the precise items that appear on each layer of each page.
When size is Page, there is the option Ignore empty layers. Empty layers are not exported. If disabled, empty layers are included. When size is Content, empty layers are always ignored and are not exported.
Section 2: File naming
Include document name — at a minimum the output file names are the layer names plus page number. Enable this option to also include the document name.
Page label at — select Begin to prefix file names with the page label (page number), or select End to append page labels to file names as a suffix.
Separator — any characters to insert between the document name (if included), the layer name, and the page label. Default is a single underscore.
Numbering minimum digits — controls how page labels are prefixed with zeros to become a minimum number of digits. This prevents the erroneous file sorting behavior still present in some systems, in which 10 precedes 2 because 1 precedes 2, even though 10 is greater in value. By adding a prefix of zeros, the same example instead becomes 002 and 010, which sort correctly in any file system.
Section 3: Options
Periods — when enabled, periods within the file name are either removed, converted to a dash, or converted to an underscore. This does not include the period before the extension, which is never removed or replaced.
Spaces — when enabled, spaces within the file name are either removed, converted to a dash, or converted to an underscore.
Letter case — when enabled, the file name is converted to either all lowercase or all uppercase.
Remove diacritics — characters with diacritics, such as accents, are converted to the equivalent basic glyph.
Section 4: Output
Folder — the folder to which layers are exported. The default is the folder where the InDesign document is located. Click the button Folder to select another. To the right is a button with three dots that opens another window with more output folder options.
Here, recent folders are listed. Click to select any in the list, and it becomes the output folder.
To remove a folder, click to select it, then click the button Remove. To remove all folders in the list, click the button Clear all. Removal occurs only if the OK button is clicked. Choose Cancel and folders removed are restored.
It’s also possible to set a folder as the default each time the script runs. Below the list is Default output folder. Click the button Set default, and choose the desired folder. Then whenever the script runs, the output folder is the same. Or leave the default (none), and it’s always where the document is located.
Pages: All or Range — controls whether to export all pages of the document, a single page, or any range or ranges of pages. For a single page or a range, the normal InDesign rules for identifying pages are recognized. Use section and/or alternate layout prefixes combined with the page number as it appears in the layout, or enter the plus sign followed by the absolute page number. Separate the first and last pages of a range with a hyphen, and separate multiple pages or page ranges with a comma.
Pages or Spreads — from the drop-down list, choose to export either Pages or Spreads.
Layers: All — every layer is output even if hidden or locked.
Layers: Visible — only visible layers are output. Hidden layers are ignored.
Layers: Unlocked — only unlocked layers are output. Locked layers are ignored.
Layers: Each unlocked combined with all locked — locked layers are not output rather included in the output of each unlocked layer. Use this for common layers such as base images and illustrations to combine with differing text layers, for example, different languages. Lock the layers for the base artwork, unlock the text layers for each language, and enable this option.
Format — the file format to which pages are exported. The available choices are JPG, PDF (interactive), PDF (Print), and PNG. Each format offers different options described next.
Replace existing output files — when enabled, existing output files are replaced. When disabled and a file of the same name exists, the text “copy” is appended to the file name to prevent overwriting the existing file. If needed, additional version numbers are added, for example “copy 2”, “copy 3”, etc.
JPG
Resolution — pixels per inch used to rasterize the pages.
Color Space — choose RGB, CMYK, or Gray.
Quality — choose Maximum, High, Medium, or Low.
Bleed — includes document bleed, if any. This option is ignored when the size option is set to content only, not the entire page.
Embed Profile — embeds the current color profile.
PDF (Interactive)
Resolution — pixels per inch for images.
Quality — image quality. Choose Maximum, High, Medium, or Low.
PDF (Print)
PDF preset — the PDF preset used to export the pages.
PDF (Interactive and Print)
Each layer and page — a separate single-page PDF is output for each layer from each page of the document.
Each layer all pages — a separate PDF is output for each layer, each of which contains the layer from all pages of the document.
PNG
Resolution — pixels per inch used to rasterize the pages.
Color Space — choose RGB or Gray.
Quality — choose Maximum, High, Medium, or Low.
Bleed — includes document bleed, if any. This option is ignored when the size option is set to content only, not the entire page.
Transparent — areas of the layer uncolored are transparent.
A note about JPG and PNG: there isn’t an option for anti-alias because the script always enables anti-alias when exporting either image format. I couldn’t imagine a need to disable the option considering that without anti-alias, the result is horrible. But perhaps I could be wrong, and there is a need to disable it. Contact me to share other views on the subject.
Section 5: Settings
The current options may be saved and restored later. Select from the Load drop-down list to choose saved settings, and the current options are updated. Click the Delete button, and the saved settings selected in the Load drop-down list are permanently removed. Click the Save button, provide a name for the settings, and the current options are preserved. If the name already exists, the user may choose to replace the saved settings. Or click the checkbox Replace settings, and choose the settings to replace.
The script provides default saved settings named [Default]. These settings cannot be deleted but may be updated to the current values. Save settings, click the checkbox Replace settings, and choose [Default].
When settings are saved, there is also the option to include Output folder.
Each time the script is launched, the output folder defaults to the location of the InDesign document. To override the default, enable the option to include Output folder. Then when the saved settings are loaded, the output folder is restored to the value set when the settings were saved. This includes the next launch of the script, as the last settings selected are also restored.
Language
By default the script language is US English, which does not require further download or configuration. To have the script interface display other languages, choose from the available languages below. Download and copy the .i18n file to the script folder alongside the script. When launched, the script detects the language file and displays interface text in that language. If your language is not listed, download the English file and translate it. The file is plain text formatted as JSON, containing interface text in English, and a second value for its translation, which for the English file is the identical text. Copy the file and rename it to replace “en” with the relevant code for your language, then edit the file to change each line’s second value to the translation in your language. For more detailed instructions of how to edit and install i18n files, see How to Localize Scripts.
English: export-layers-en-i18n.zip
FREE 30 DAY TRIAL
Single-user perpetual license
Pay once, no subscription, use forever
Change log: export-layers.txt
For help installing scripts, see How to Install and Use Scripts in Adobe Creative Cloud Applications.
IMPORTANT: scripts are developed for the latest Adobe Creative Cloud applications. Many scripts work in CC 2018 and later, even some as far back as CS6, but may not perform as expected, or run at all, when used in versions prior to 2018. Photoshop features Select Subject and Preserve Details 2.0 definitely fail prior to CC 2018 (version 19) as the features do not exist in earlier versions. For best results use the latest versions of Adobe Creative Cloud applications.
IMPORTANT: by downloading any of the scripts on this page you agree that the software is provided without any warranty, express or implied. USE AT YOUR OWN RISK. Always make backups of important data.
IMPORTANT: fees paid for software products are the purchase of a non-exclusive license to use the software product and do not grant the purchaser any degree of ownership of the software code. Author of the intellectual property and copyright holder William Campbell retains 100% ownership of all code used in all software products regardless of the inspiration for the software product design or functionality.