Next Previous Contents

3. icotool

Usage:

icotool [OPTIONS]... [FILE]...

The icotool program reads .ICO or .CUR files, and lists or extracts the images they contain. At this time, the only supported image format is XPM. icotool does not require any libraries to make XPM files.

Filters, specified as command line options, control what images to extract.

3.1 Command line options

-x, --extract

Extract images in file. (By default, images will be extracted to standard out if --output was not specified.)

-l, --list

Output list of images in file (default).

-c, --create

Create icon files from specified images (not yet implemented).

-i, --index=NUMBER

Index of the image to perform operation on.

-w, --width=PIXELS

Match images of this specific width only.

-h, --height=PIXELS

Match images of this specific height only.

-C, --colors=COUNT

Match images of this number of colors only.

-X, --hotspot-x=PIXELS

If matching cursor, match only cursor where the hotspot X-coordinate is this value.

-Y, --hotspot-y=PIXELS

If matching cursor, match only cursor where the hotspot Y-coordinate is this value.

--icon

Match icon files only.

--cursor

Match cursor files only.

-a, --all

Perform operation on all images (default)

-o, --output=PATH

Speicifies where to place extracted images. If PATH does not refer to an existing directory, and does not end with a slash ('/'), all output will be written to the file denoted by PATH. (This means that if you extract multiple images, PATH will contain the last images only.)

-O, --output-base=BASE

Similar to --output, but here BASE is the basename of extracted files. For example, if BASE is "tmp_", the extracted image files would be named "tmp_C_WxH.FMT" (where C is number of colors, W width and H height).

This option cannot be combined with the --output option.

--format=FORMAT

Extraction format; "xpm", or "ppm". At this time, only the "xpm" format is supported though.

-m, --image-mode=MODE

Controls what will be extracted of each image; "image" for image data only, "mask" for only mask, or "both" for both (default).

-v, --verbose

Explain what is being done. The verbose option may be specified more than once, like "-vv", to make icotool even more verbose.

--help

Display a help message and exit.

--version

Output version information and exit.

3.2 Examples

List all images in file "demo.ico":

$ icotool -l demo.ico
--icon --index=0 --width=32 --height=32 --colors=16
--icon --index=1 --width=16 --height=16 --colors=16
--icon --index=2 --width=48 --height=48 --colors=16
--icon --index=3 --width=16 --height=16 --colors=256
--icon --index=4 --width=32 --height=32 --colors=256
--icon --index=5 --width=48 --height=48 --colors=256
$

List only 16-color images in "demo.ico":

$ icotool -l --colors=16 demo.ico
--icon --index=0 --width=32 --height=32 --colors=16
--icon --index=1 --width=16 --height=16 --colors=16
--icon --index=2 --width=48 --height=48 --colors=16
$

Extract all images to current directory, naming the destination files "demo.ico_C_WxH.xpm":

$ icotool -x --output=. demo.ico
$ ls *.xpm
demo.ico_16_16x16.xpm  demo.ico_16_48x48.xpm   demo.ico_256_32x32.xpm
demo.ico_16_32x32.xpm  demo.ico_256_16x16.xpm  demo.ico_256_48x48.xpm
$

Extract all 256-color icon images in all .ico files in the current dir, placing the extracted images in "img/"

$ icotool -x -oimg/ -C256 *.ico
$


Next Previous Contents