Skip to content

wapp_image

sebo-b edited this page Mar 7, 2023 · 2 revisions

NAME

wapp_image - a utility to encodes/decodes image between PNG and Fossil Hybrid watch format.

SYNOPSIS

wapp_image encode [-h] [-v] -i INPUT_FILE -o OUTPUT_FILE [-s WIDTHxHEIGHT] [-f {rle,raw}]

wapp_image encode [-h] [-v] -i INPUT_FILE -o OUTPUT_FILE [-f {auto,rle,raw}]

COMMON OPTIONS

-h, --help display help information

-v, --verbose verbose output

COMMANDS

encode

Encodes PNG into Fossil format (raw or rle).

wapp_image encode [-h] [-v] -i INPUT_FILE -o OUTPUT_FILE [-s WIDTHxHEIGHT] [-f {rle,raw}]

Input file

-i INPUT_FILE, --input INPUT_FILE

Non-optional. Input (source) file in PNG format with a colorspace RGB/24 or RGBA/32 or Greyscale or Greyscale with alpha.

Output file

-o OUTPUT_FILE, --output OUTPUT_FILE

Non-optional. Output (destination) file. If exists it will be overwritten without warning.

Scale

-s WIDTHxHEIGHT, --resize WIDTHxHEIGHT

Optional. Resolution of the output image. If different then the resolution of the input image, the image will be scaled using the nearest neighbor algorithm. The parameter should be passed as WIDTHxHEIGHT e.g. 120x120. It is also possible to pass one of the dimensions, either WIDTH or xHEIGHT. In such a case the other dimension will be kept as it is, so the image aspect ratio may change.

Format

-f {rle,raw}, --format {rle,raw}

Optional. Format of the output, either RAW or RLE. If not specified, the default is RLE.

NOTE: RLE is recommended even for the background, as it is usually much smaller and it supports alpha.

decode

Decodes Fossil format, either RAW or RLE, into PNG.

wapp_image decode [-h] [-v] -i INPUT_FILE -o OUTPUT_FILE [-f {auto,rle,raw}]

Input file

-i INPUT_FILE, --input INPUT_FILE

Input (source) file, either RAW or RLE.

Output file

-o OUTPUT_FILE, --output OUTPUT_FILE

Output (destination) PNG file. If exists it will be overwritten without warning.

Format

-f {auto,rle,raw}, --format {auto,rle,raw}

Format of the input image, either rle, raw or auto. By default auto is used, so the input format is autodetected. In all normal cases, autodetection should work, however, it is possible to prepare a RAW image that will mimic the RLE image.

USAGE

Example usage:

To convert PNG into RLE:

fossil_image encode -i icon_home.png -o icon_home

To convert and scale PNG into RLE:

fossil_image encode -i icon_home.png -o icon_home -s 32x32

To convert PNG into RAW (note that in almost every case RLE format produces smaller files):

fossil_image encode -i background.png -o background.raw -f raw

To convert RLE or RAW (autodetection used) back to PNG:

fossil_image decode -i background -o background.png

To convert RAW (no autodetection) back to PNG:

fossil_image decode -i background -o background.png -f raw

NOTES / REMARKS

  • The maximum file size is 64kB as larger files cannot be packed into .wapp
  • The maximum resolution of RLE file is 256x256
  • Both RLE and RAW images support only grey/2bit color space. The following PNG luminance ranges are used for conversion 0x00--0x55--0xaa--0xff
  • RLE also supports 2-bit of alpha
Clone this wiki locally