Skip to content

Commit

Permalink
doc: update readme for autosize
Browse files Browse the repository at this point in the history
  • Loading branch information
relikd committed Mar 18, 2023
1 parent 6a82adc commit d6d3c88
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
2 changes: 1 addition & 1 deletion LICENSE
@@ -1,4 +1,4 @@
Copyright 2021 Oleg Geier
Copyright 2021-2023 relikd

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
32 changes: 31 additions & 1 deletion README.md
Expand Up @@ -14,17 +14,21 @@ Or you can install it **manually** by creating a symlink to `cli.py`:

```sh
ln -s '/absolute/path/to/icnsutil/icnsutil/cli.py' /usr/local/bin/icnsutil
ln -s '/absolute/path/to/icnsutil/icnsutil/autosize/cli.py' /usr/local/bin/icnsutil-autosize
```

Or call the python module (if the module is in the search path):

```sh
python3 -m icnsutil
python3 -m icnsutil.autosize
```


## Usage

See [#tools](#tools) for further options on icns processing (e.g., autosize).

```
positional arguments:
command
Expand Down Expand Up @@ -128,7 +132,33 @@ with open('32x32.mask', 'wb') as fp:

Note: the CLI `export` command will fail if you run `--convert` without Pillow.

## HTML icon viewer

## Tools

### Autosize

`icnsutil.autosize` is a tool to automatically generate smaller icon sizes from a larger one.
Currently, autosize has support for “normal” raster images (via sips or Pillow) and SVG images (via [resvg] or Chrome Headless).

```sh
icnsutil-autosize icon.svg -32 intermediate.png -16 small.svg
# or
python3 -m icnsutil.autosize icon.svg -32 intermediate.png -16 small.svg
```

Additionally, `autosize` will also try to convert 32px and 16px PNG images to ARGB.
If Pillow is not installed, this step will be skipped (without negative side effects).
The output is an iconset folder with all necessary images.

You may ask why this tool does not create the icns file immediatelly?
This way you can modify the generated images before packing them into an icns file.
For example, you can run [ImageOptim] to compress the images and reduce the overall icns filesize.

[resvg]: https://github.com/RazrFalcon/resvg/
[ImageOptim]: https://github.com/ImageOptim/ImageOptim


### HTML icon viewer

Here are two tools to open icns files directly in your browser. Both tools can be used either with an icns file or a rgb / argb image file.

Expand Down

0 comments on commit d6d3c88

Please sign in to comment.