GithubHelp home page GithubHelp logo

illustrator-layer-exporter's Introduction

#Layer Exporter for Adobe Illustrator

image

Layer Exporter lets you automatically export Illustrator layers to SVG, JPG or PNG files, along with coordinates data and HTML CSS files, with a single click. Think of it as a modest equivalent of Photoshop Asset Generator for Illustrator, with full HTML & CSS export.

It's a free & open source extension panel for Adobe Illustrator CC, made with the creative cloud extensiblity helpers.

##Install

CC extensions can either be installed via the built-in Adobe Exchange Panel (preferred method), or via a ZXP package executed in Extension Manager CC (which you must install first via the Creative Cloud Desktop application).

Open Illustrator and choose Window > extensions > Adobe Echange to open the exchange panel, look for "Layer exporter" and you should find it directly.

image

Alternatively, you can download and install the current production ZXP (stable) or the development ZXP (use with caution) for use with Extension Manager CC from the bin folder.

##Exporting Images

This panel uses naming conventions to create the JPG, PNG or SVG files from your artwork. For instance, to export the content of your "Logo" layer, simply rename it to "Logo.png", and your Logo.png file will be created in your destination folder.

image

Once you click the Export button, it will parse both layers and individual art items contained in those layers. All layers or items suffixed with a supported image file format will be created, unless it was made invisible. However, please note that only top level layers will be used, as sub-layers will be ignored.

The Options panel will let you specify globally image format options such as JPG quality, or whether or not SVG should outline text. Contrary to Photoshop Generator, you cannot set those options for individual image files.

image

###Exporting Layers

If you have a big file with many layers, renaming all those layers can be somewhat tedious. To help you with that renaming step, you can use the Tools panel to automatically rename all your layers so that they get exported to the appropriate file format.

Choosing None will simply remove all suffixes from layer names

image

###Exporting art items

All art items (such as paths, texts and groups) inside layers can also be suffixed to be exported to image files, even if its parent layer has itself been renamed to be exported as an image file.

You can automatically set the destination format for the items you selected by clicking the appropriate button in the Tools panel.

You can also use the Move selected items options to automatically create top level layers from those items. Choose One Layer to gather all selected items to the same new Layer. Alternatively, choose Multiple Layers to create as many layers as the selected items, each being located in its own layer.

##Exporting composition data

If you want to use exported image files somewhere (say, in a webpage or a native app), chances are you're going to need to get the coordinates of those elements in order to recreate the original composition.

There several options to help you with that.

###Exporting to HTML (static)

If you want to export your whole composition to HTML, choose the corresponding option to generate an HTML file in the parent folder of destination folder for the images.

You can choose to have CSS styles declared inside a <style> tag in the <head> of this HTML page, or to create a separate CSS file.

Layer Exporter will then use HTML tags to describe the composition, starting with a top level div named after the Illustrator file. Inside this div, all exported Layers will be converted to img tags.

Any layer that is not suffixed with a supported image file will be considered as a child div of the main div. All art items inside this layer suffixed with a supported image file format will be considered as a child img tag of the parent div.

image

Here's what a typical HTML output could look like (go to the samples folder for more details).

image

###Exporting to HTML (dynamic)

Alternatively, if you don't want to statically generate HTML and CSS code, you can choose to interpret the JSON file at runtime using javascript. You'll find sample code to help you do that in the utils folder of this repo, and a sample lanscape project in the samples folder.

###Experimental HTML features

We're working on some additional features to help with HTML export. Since those features are experimental, they are likely to change in the future. Also, things will break.

  • Text: text items suffixed with =text will be converted to full HTML text with the corresponding CSS styles (font family, font size, color and alignment).
  • Div backgrounds: inside layers, path items named "#bgd" will be ignored but used to determine the background color and opacity of the parent div.

For a full example of all those features, you can jump to the samples folder.

###Edge Animate project

Layer Exporter has (limited) support for Adobe's Edge Animate Projects.

Since Edge Animate supports HTML as input, you could simply open it inside the tool, but you'd then be missing a few capabilities, such as the ability to group or create symbol.

The Import to Edge Animate option lets you choose an existing .an file and will overwrite it with the corresponding data. A typical workflow would then consist of first creating a empty .an project, importing the illustrator composition via the Import to Edge Animate option, and then updating artwork as needed from Illustrator.

You'll find an empty Edge Animate project in the utils folder.

###Exporting to other contexts

Alternatively, you can choose to create a dump of the raw data of the composition so that you, a developer, or a 3rd party tool can interpret the data . Choose the Create JSON data file to create a JSON representation of the composition inside the image destination folder.

image

##Release notes

v 2.1.0 - May 28th 2014

  • Added HTML doctype
  • Art items are now correctly ignored from export if invisible
  • All invisible items are now correctly ignored from HTML output
  • Added css locations options for SVG
  • Added support for Illustrator next

V 2.0.1 - April 7th 2014

WARNING: this release has major functional differences with previous builds. You may have to reorganize your art to conform to the new model.

  • You can now also separately export art items inside layers. By default, layers are no longer exported as images and are treated as divs in HTML. Sub layers are not supported.
  • Art items named "#bgd" inside layers are ignored but used to set the background color & opacity of the parent div.
  • Elements suffixed with "=text" inside layers are exported as text and converted to <p> tags in HTML.
  • Option to generate separate CSS files for HTML export
  • Option to generate the data.json file
  • New Helper tools to automate layer and items suffixes

V 1.5.0 - March 11th 2014

  • Generate HTML pages including all generated assets (including CSS)
  • Import to Edge Animate
  • New Helper tools to create layers from path items
  • New UI based on topcoat (Regression: host theme support is removed in this build)
  • Bug Fixes

V 1.0 - June 2013

  • Generate JPG, PNG & SVG via layer names
  • Options to define the quality of JPG and SVG text handling
  • data.json file describes the scene graph for 3rd party tools

##Known issues

  • Sublayers are not supported. Rationale: a recursive process could be used, but an Illustrator bug prevents from knowing the relative zorder of layers vs art items, making it impossible to create a proper representation of the whole composition.
  • Special items (divs backgrounds and texts) are not currently supported in edge animate export
  • Layer names cannot be set with the same UX as with art items (eg "set selected layers as PNG"). Rationale: the illustrator API does not let us know which layers are selected.

##FAQ

###Why do I need Illustrator CC / 17.0+? Sorry, CC apps have a new engine for extensions which lets you create panels using nothing but web standards. This is what this panel uses. You can still port it by yourself, of course.

###How can I convert my rectangles to simple divs?

Because it would be stupid to use image files for simple rectangles when you could use div, you can simply use a non-suffixed layer with a rectangle inside. Using the (experimental) background element feature, this layer will be converted to a div and the underlying rectangle will be use to set the CSS for the size and the color.

###Can I inline SVG code in HTML rather than use img?

Unfortunately, no. Illustrator's API does not expose the generated SVG code, it only allows to automate file export.

###Hey, the exported SVG code sucks! While it does the job, the Illustrator SVG export engine is not so great in the first place. I highly recommend using SVGO for optimization.

###Why doesn't it work with my appearances? Sorry, appearances are not supported at this stage.

###Does it support symbols? Yes and no. Symbols instances will all be treated as separated image files.

###What about sublayers? Not supported, amigos.

##About the source code

This repository is the source for the panel. The underlying logic, written in ExtendScript, is located in the CSscript repository.

##Special thanks to

illustrator-layer-exporter's People

Contributors

davidderaedt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

illustrator-layer-exporter's Issues

dead project?

Unfortunately, as all the good stuff, it's not being maintained.

Install issues from Adobe Exchange panel

Some users report installation issues from the Exchange Panel. This seems to be an issue on the Exchange Panel side, but so far we were unable to isolate & reproduce.

Recommended fix: install from the ZXP using Extension Manager CC.

Sub-layers are ignored

Layer Exporter does not export sub-layers, or art items contained in sub-layers even though they were correctly suffixed.

include document's name prefix, size PNG, export to same location as Illustrator file

who can help me to modify the Illustrator-Layer-Exporter to include these functionality:

  1. document's name as a prefix combined with the layer name (e.g. to become: documentname_layername.png)

  2. set size of the PNG (e.g. 72dpi, 150dpi, 300dpi, or at least a percentage).

  3. save on export in the same location as the original file.

My knowledge of Java is close to zero.
Will send you a nice present in return.

Mask layer crops to the hidden object

When I have a layer where an object is masked, LE takes all of the objects on the layer to determine the position even though nothing is displayed "outside" the mask.

The resulting CSS scales weirdly. (Here, the disk is masked by the rectangle, but LE will put a full box around the object).
capture d ecran 2015-06-10 a 16 35 17

No way to customize element cropping

As of now, graphical elements are always exported at their visible size, with no way to crop or add any margin around them.

A possible fix would involve artboards: when a specific atrboard is selected, all elements would be centered and exported using the absolute width and height of this artboard. This still need further investigations.

Html export svg assets size

I know the html export is a Work in Progress, so, it's a good start, and can be animated inside Edge Animate, but so far it doesn't seem to remember the size of the svg items they are all huge !

ai-layexp-an-svg

Artboad not reflected

maybe its a featurerequest: export the layer reflecting the artboard. At the moment all elements on the layer get exported. Images bigger than the artboard, even with clipping masks within the artboard, are fully exportet and not croped to the artboards dimensions.

HiDPI export?

All we need to export not just only images but images with high resolution screens support – an images with double pixel ratio. I think that we need to use @2x postfix in layer names ([email protected] for example) or set it globally with checkbox.

Works bad in Ilustrator CC 2014

Sometimes it works, sometimes not. “Set selected items as” button replaces item name with format, .png for example, and do not saves item name.

Inconsistent UX in Tools panel

The UX in the tools panel is inconsistent in the way it lets users rename elements: layers are all renamed at the same time, while for art items, selected items can be renamed separately.

The inability to only rename selected layers comes from the fact that Illustrator does not expose any API to retrieve layer selection.

Different class names for multiple SVG styles

Hey there! I'm using this plugin to export a bunch of SVG elements and then importing them with document.importNode to an html document. When the SVGs get exported with the plugin, they all get the same class names like "st0" and "st1", so when I use them all together, it applies the last imported node's styles to everything. I was wondering if there was a fix for this.

Thanks!

Support for sublayers

I know the author said that sub layers are not supported by design but wanted to just mention this here in case anyone else comes looking:

This thread has some solutions to the problem of finding out the order of layers and page items relative to each other.
https://forums.adobe.com/thread/538263

In short, it suggests getting this information from the document.pageItems property. I've also confirmed that this does seem to work

Set Selected layers as (svg/png/jpg/none)

Sometimes, after preparing my files properly, i'd love to export (again) only a subset of layers, I'd need an option to "set selected layers as"

So far, I can set all layers or set items inside layers. First option is too "wide", second option goes inside the layer and changes the first item's extension, but not the layer's name, hence I'd have to move all to layers, but then need to rename…

Start from:
layerIWant.png
layerIwant.jpg
layerIdontwant.png
layeridontwant.jpg

would like an easy way to:
layerIWant.png
layerIwant.jpg
layerIdontwant
layeridontwant

(of course, i have more than 4 layers…)

Installed but not available

I restarted Illustrator. The extension is seen as installed, but not available in the window menu.

installationlayerexchange

I received an authentify request from ExManCmd, was told it was installed, but not available to find it. Maybe language issue (shown as EN when my OS and Ai are FR…)

-- edit après install --
On Retina MBPro (10.8), extension installed silently and is shown where expected. It isn't a FR vs EN issue.

Losing a pixel or two at the bottom of PNG image on export

Hi David - thank you for putting this together, I'm just having one issue with it though and was wondering if you could help.

On exporting a PNG (I name the layer as a PNG file first and then hit the export button) the PNG is generated fine but it cuts off what seems to be two pixels from the bottom of the image.

I've tried this on different layers and also on different Macs (one with the extension installed via Adobe Exchange, the other via the ZXP package).

I've attached a couple of the other images in case it helps:

dots

step1

Cheers

Html export png - replace images - create symbols

This is an Animate problem, but i realize this while testing LE 1.4

When you use an .html file in Animate, it's not possible to swap images with something else, since they're defined as inside the html file/DOM.

We also loose a lot of the interactivity available in Animate, since an image itself cannot be grouped or put inside a symbol (with its own timeline and interactivity).

This advocates in favor of a distinct .html AND .an export :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.