Skip to content
This repository has been archived by the owner on May 1, 2020. It is now read-only.
James Chambers edited this page Jan 19, 2015 · 7 revisions

Renderizer

DPI of Illustrator Files

The Illustrator AppleScript interface does not accept a DPI property when exporting images; it does, however, accept a scaling property. So, the scaling property must be based on the source dpi. This is assumed to be 72. If it is not, use the srcdpi property in an output block to specify otherwise.

When making new files in Illustrator, choose a document profile with a ppi of x. Then, the width and height you specify will be the width and height of the image created with a dpi of x specified in your images.yaml file.

DPI of Inkscape Files

Inkscape seems to default to 90 DPI (for SVG files, at least). So, if you specify x by y pixels as the size of your image when creating an image in Inkscape, render at 90 DPI to get an image of x by y pixels.

If you'd like to maintain some consistency of DPI values with Illustrator, you can use this hack: specify x by y as size of your image in points in Inkscape when creating a file. Then, when you specify a DPI of 72 in your images.yaml file, the image will be x by y pixels when rendered.

Properties supported in an output block

  • path: the destination path, from your project directory
  • dpi: the dpi sent to the render backend; for Inkscape this is specified directly on the command line, for Illustrator this is divided by the srcdpi to produce the scaling property, unless scaling is set manually.
  • srcdpi: dpi of the source image; used by the Illustrator backend to calculate the scaling property
  • scaling: given directly to Illustrator, telling it how much to scale the width and height of the file in percent. For example 100 (to get the size it was created at) or 200 (to get twice the size it was created at).
  • backend: the renderer to use. Currently 'illustrator' and 'inkscape' are supported.
  • prepend: prepends some string to the beginning of each filename
  • append: appends some string to the end of each filename (before the .png extension).
  • rename: sets some string to the name of each file rendered. Really only useful if you have a group which only has a single image.

The following properties are supported in both the output block and in an image group:

  • simtype: simulator type, retrieved from Titanium when run as a Ti build plugin. For example 'iphone'. This can be a single string or an array of acceptable values.
  • devicefamily: also retrieved from Ti. Can also be a single str or an array of acceptable strings.
  • platform: Ti prop, can be a str or array of acceptable strs. For example 'ios'.
  • command: Ti prop, can be a str or array of acceptable strs. For example 'simulator'.
  • deploytype: Ti prop, can be a str or array of acceptable strs. For example 'development' or 'production'.

You're using the terms dpi and ppi totally incorrectly!

Probably. I'm a developer, not a graphic designer -- I'm concerned with getting the images rendered at the proper resolution. The DPI and PPI that Inkscape and Illustrator use are probably just properties in the files somewhere. I just need to know what to tell my graphic designer in order to properly automate the rendering process.

This doesn't work with my version of Illustrator!

I'm sorry to hear that. Unfortunately, Adobe's AppleScript interface for Illustrator is notoriously crappy. The version of Illustrator I have is CS5, and it works for me. If you can get it working with an older version of Illustrator, open a pull request or send me the code and I'll integrate it.

How can I render images with x?

You'll need to add another render backend. This will involve writing a function that accepts input, output, and the output dict as specified in the images.yaml file. Then, you add this function to the backends dict in the compile function.