When you build apps you will probably consume few images, just a few or quite a lot
and ultimately you want to automate that for few different reasons
Support All Icons
AIR is great, but when it comes to support application icons
and so in a cross-platform way it can become quite complicated
simply because each system have their own rules
check the Icon Handbook which has a great Icon Reference Chart
on the CLI
for Windows, there are many tools
most of those tools run on the command-line,
I personally recommend ResourceHacker
for macOS, use sips
scriptable image processing system
$ man sips
with that tool you can extract images from
and also update
.icnswith new size
see for examples
the idea is to have a base icon 1024x1024 and be able to generate/refresh/update all the icons at the time you’re building the app.
OK, I agree, you do not change your app icon every day, and so all this could be considered optional, but we are talking about automation here, do your scripts once for one app, and you will probably be able to re-use those for any following apps.
Streamline your Assets
You want to do that for a lot of reasons
- file size
- format standardisation
- performance / optimization
Simply put, you can use different command-line tools to batch multiple images that you use as ressources in your app
See that old blog post from 2013, still valid today
Tools for image optimization
but all great that is ImageMagick it might not be the best tool to optimize
so look into other tools like pngquant etc. mentioned in the blog post above
also look at TinyPNG/TinyJPG Third-party solutions
you can find tools that use multiple other tools, like ImageOptim (only macOS) and toy/image_optim (eg. “Command line tool and ruby interface to optimize (lossless compress, optionally lossy) jpeg, png, gif and svg images using external utilities”).
that’s the whole point of using the CLI, you’re not stuck with only one tool, you can chain many different tools with their own specialization
Know your AIR
BitmapData.encode() does exists and is native
it is there since Flash Player 11.3 and AIR 3.3 (and sometimes I’m baffled that some dev still don;t know that it is native).
And yeah, AIR does not work purely on the command-line but you can automate it when you’re building from a desktop and/or use it to dynamically generates those formats at runtime (from vector files for ex).
Seriously, just a couple of classes in your app can run your app in a “special mode” where you can save screenshots automatically, or even producing your own little AIR helper where you simply invoke it from the command-line.
[Embed] does exists too
you could, for example, download
.svg icons from some open source libraries
automatically generate the classes that embed those SVG, etc.
check the post Problem embedding images
temporary but it got the essential