#shadow #image #command-line-tool #borders #padding #utility #add

app shadower

A simple CLI utility to add rounded borders, padding, and shadows to images

4 releases

0.1.4 Mar 17, 2023
0.1.3 Mar 16, 2023
0.1.2 Mar 10, 2023
0.1.1 Mar 10, 2023
0.1.0 Mar 10, 2023

#9 in #shadow

42 downloads per month

MIT license

22KB
524 lines

shadower

a simple command-line utility to add rounded corners and shadows to images

GitHub GitHub top language Crates.io AUR votes wakatime

Installation

From AUR

paru -S shadower-git

From source

cargo build --release

From crates.io

cargo install shadower

Usage

shadower by default reads the image from stdin and outputs it to stdout, so here are some non-config examples:

  • wl-paste | shadower | wl-copy
  • shadower < image.png > image_shadow.png
  • grimblast save active - | shadower | wl-copy

However, you can also customize every aspect of the rounding, shadows, and padding of the images. To do so, you can use math expressions, which let you dynamically calculate the values depending on the size of the input image. For example, setting the --offset-y to max / 6 / 4, while running on a 800x600px image, will result in the shadow being offset down by 33.(3)px.
You can also use the clamp(min, val, max) function to clamp a function to a given min and max, or if you only need a min or max, put _ in the unnecessary value. (clamp(_, 20, 10) is min(20, 10))

To view all the flags, use --help.

Config file

You can also configure shadower using a config file instead of the flags. The default config location is $XDG_CONFIG_HOME/shadower/config.toml, but you can override it using the --config flag. The config file can change every option (except the --config), and you just have to put the values in. The keys have to use snake_case instead of kebab-case.

Example config:

radius="20"
padding_x="15 + max/2"

You can use environment variables, they will be expanded.

The default config values are always displayed in the --help.

Note: flags have priority over the config file

Contributing

  1. Make a fork
  2. Make your changes
  3. Commit the changes (please use conventional commits!)
  4. Create a PR

No need to ask me if you can implement something, if I think it's a good thing I'll merge it in.

Dependencies

~9–12MB
~211K SLoC