[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.2 Generating Icons

The main application icon was drawn by hand in the GIMP, and can be found in ‘IconMaster.xcf’. For Android Nougat and earlier, this raster image is scaled down from 384×384 to about ½ inch on screen: a 60×60 icon in ‘res/drawable-ldpi/icon.png’, 80×80 in ‘res/drawable-mdpi/icon.png’, 120×120 in ‘res/drawable-hdpi/icon.png’, and 160×160 in ‘res/drawable-xhdpi/icon.png’.

Android Oreo introduced “adaptive icons”, so the usual icon — which has the natural rectangular shape of a piece of paper — had to be squeezed down to fit into a mask that can be anything from a rounded squircle to a circle. To generate the various sizes of this icon, the canvas has to be enlarged to and then scaled back down to 80×80, 120×120, 160×160, and 240×240 for the various pixel densities in ‘res/drawable-*dpi/icon_foreground.png’. In addition, a background image has to be provided in ‘res/drawable-*dpi/icon_background.png’.

Reproducibility Issues Some publishing systems (e.g. F-Droid) require that compiled code and generated / modified resources be kept exactly the same across any build environment. When writing PNG images, applications tend to use the system’s “zlib” compression library, which is ordinarily the one provided from zlib.net. Some systems may replace this library with an alternative such as “zlib-ng”; in order to get consistent output, you may need to install “zlib” separately and have this library loaded when running Android Studio, ‘./gradlew’, and any other application you use to create PNG images. For example, the following may be used from the command line:

export LD_PRELOAD=/usr/local/lib/libz.so.1

which will cause the application to use the zlib implementation in ‘/usr/local/lib/’ instead of the default implementation in ‘/usr/lib/’ or ‘/usr/lib64/’.

EXIF Prohibition Some publishing platforms such as F-Droid forbid any EXIF metadata in images. The exiftool utility may be used to strip this metadata from your images:

exiftool -all= drawable*/*.png

The tool renames the original files to e.g. ‘abc.png_original’.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on March 27, 2025 using texi2html 5.0.