doc: update readme for autosize

This commit is contained in:
relikd
2023-03-18 13:17:55 +01:00
parent 6a82adcd1f
commit d6d3c88ee8
2 changed files with 32 additions and 2 deletions

View File

@@ -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:

View File

@@ -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
@@ -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.