Skip to content

Configuration Options

samgannawayA edited this page Nov 13, 2017 · 40 revisions

The Generator Assets plugin for Generator supports the following configuration options:

  • svg-enabled: Whether or not to allow experimental creation of SVG assets (default: true)
  • svgomg-enabled: If true (the default), use the experimental svgObjectModelGenerator library for creation of SVG assets. If false, use the built in JSX implementation. Requires svg-enabled to be set to true. (default: true)
  • css-enabled: Whether to expose the experimental 'Copy Layer CSS To Clipboard' menu option. (default: false)
  • webp-enabled: Whether or not to allow experimental creation of WEBP assets (only available on Mac OS, currently) (default: false)
  • webp-lossless: Use lossless compression for webp format. (default: false)
  • use-smart-scaling: Use Photoshop's "smart" scaling to scale layer, which (confusingly) means that stroke effects (e.g. rounded rect corners) are not scaled. (default: false)
  • include-ancestor-masks: Cause exported layer to be clipped by any ancestor masks that are visible. (ancestor meaning any group layers that contain the layer). Also incorporates the ancestor layer styling ie. group fx, blend mode, opacity, etc. (default: false)
  • allow-dither: Force the use of dithering when converting to 8-bit RGB in cases where the conversion would be lossy. The assets plug-in is not affected by the dithering settings in Photoshop's "Color Settings" dialog (under the "Edit" menu). By default, dithering is off. Setting this to true forces it to be on (again, regardless of Photoshop's color settings). (default: false)
  • interpolation-type: Force Photoshop to use the given interpolation method when scaling pixmaps. If defined, should take the value of one of the INTERPOLATION constants defined in Generator core: nearestNeighbor, bilinear, bicubic, bicubicSmoother, bicubicSharper, bicubicAutomatic, preserveDetailsUpscale or automaticInterpolation. Otherwise, Photoshop's default interpolation is used.
  • use-psd-smart-object-pixel-scaling: When set to true, force Photoshop to scale PSD smart objects in pixel space. In PS <= 15.0, PSD smart objects were always scaled in pixel space, which led to fuzzy vectors. In PS >= 15.1, PSD smart objects will by default be scaled in a vector-preserving way. This option forces the old behavior. (default: false)
  • use-pngquant: When set to true, use pngquant for compression of 8-bit PNGs instead of ImageMagick's convert. This only applies to assets with the .png8 tag. (default: true)
  • base-directory: When set, place all documentname-assets folders inside the specified base-directory path. Note that base-directory should be an absolute path (e.g. /Users/jbrandt/Desktop on Mac). If the path is relative, it will be resolved relative to the system root, which is likely not what the user wants. (And, will likely lead to permission errors.) (default: undefined)
  • use-flite: Use FLITE transcoder instead of ImageMagick (default: true)
  • convert-color-space: When set to true, performs a color conversion on the pixels before they are sent to Generator. The color is converted to the working RGB profile (specified for the document in PS). By default (when this setting is false), the "raw" RGB data is sent, which is what is usually desired. (default: false)
  • icc-profile: String with the ICC color profile to use. If set this overrides the convert-color-space flag. A common value is "sRGB IEC61966-2.1"
  • embed-icc-profile: When true, fetch the color profile of the PSD and embed it in the output file. Requires use-flite. (default: false)
  • use-jpg-encoding: Either "optimal" or "precomputed" to override default huffman coding. Requires use-flite. (default: null)
  • clip-all-images-to-document-bounds: Indicates whether exported assets should get clipped to the document bounds or not (default: true)
  • clip-all-images-to-artboard-bounds: Indicates whether exported assets should get clipped to the artboard bounds or not (for layers that are inside an artboard) (default: true)
  • mask-adds-padding: Indicates whether layer and vector masks that are larger than the layer size will increase the output image dimensions to fit the masked area. (default: true)
  • expand-max-dimensions: Allow slightly larger max dimensions. If false, uses static max dimensions. (default: false)

Generator Config panel

A free extension panel is available from the Adobe Add-ons web site. This panel provides checkboxes and menus for the various options, updates the configuration file, and re-starts Generator with the new configuration. The panel is open source.

Sample configuration

{
    // ...
    "generator-assets":  { 
	"svg-enabled":true,
	"svgomg-enabled":true,
	"css-enabled":false,
	"use-smart-scaling":false,
	"include-ancestor-masks":false,
	"allow-dither":false,
	"use-psd-smart-object-pixel-scaling":false,
	"use-pngquant":true,
	"convert-color-space":false,
	"use-flite":true,
	"embed-icc-profile":true,
	"clip-all-images-to-document-bounds":true,
	"clip-all-images-to-artboard-bounds":true,
	"mask-adds-padding":true,
	"expand-max-dimensions":false,
	"webp-enabled":false,
	"interpolation-type":"bicubicAutomatic",
	"icc-profile":"sRGB IEC61966-2.1",
	"use-jpg-encoding":"optimal"
    }
    // ...
}