by

TiCons CLI

April last year, I launched TiCons – a simple online tool written in PHP to generate all your Titanium (and Alloy) icons and splash screens (launch images) from a single source.

Each month, it is used to generate icons for 600 apps!

Module & CLI

Last month, I developed a NodeJS CommonJS module and CLI version of TiCons. I needed this myself for an app factory I was doing and while I was at it, also added some new features. I hope to rebuild the web version some time soon to use the CLI as well.

Nine-patch

One important thing the web version is missing are Nine-patch splash screens for Android. Some while ago, the Titanium docs were updated to point out there’s no way you could include a splash image for all of the many screen sizes of Android devices.

The CLI by default will resize your input to the maximum that will fit inside the generalized size of each density. It will then add a nine-patch border that will stretch (repeat) the outer most line of pixels to fill up the screen. To understand how nine-patch works, read Malcolm’s post at TiDev about Android Splash Screens Using 9-Patch Images.

Nine-patch emulation

The CLI also has a --no-crop option to emulate nine-patch splash screens for the other platforms. You could use the same input as for Android and the CLI will do the same as it did for Android, but instead of adding a nine-patch border, it will repeat the outer most line of pixels itself to fill up the remaining space.

Consider the following example generated using:

or

which would result in images like:

TiCons CLI

Smart defaults

A major benefit of using the CLI compared to the web version is that the CLI is able to analyze the project you run it in. TiCons will figure out lots of smart defaults like:

  • If the project is classic instead of Alloy.
  • What platforms are targetted ().
  • If the app is locked to one orientation (UISupportedInterfaceOrientations etc.).

In the CLI, you can add the trace (-t) option to see exactly what configuration is used based on your options and the smart defaults.

Roadmap

The main thing I’d like to add next is an assets command which would take a path to a single or folder of images and generate missing densities. You would for example be able to point it to app/assets/iphone/images which would then generate non-retina/mdpi images in app/assets/images and ldpi/xhdpi/xxhdpi images under app/assets/android/images.

Feel free to fork the code if you want to help out with this.