Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alex8088/shadowizer
A cli tool for adding box shadow to images
https://github.com/alex8088/shadowizer
box-shadow image shadow
Last synced: 3 months ago
JSON representation
A cli tool for adding box shadow to images
- Host: GitHub
- URL: https://github.com/alex8088/shadowizer
- Owner: alex8088
- License: mit
- Created: 2024-06-19T14:19:35.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-06-22T16:02:37.000Z (8 months ago)
- Last Synced: 2024-09-26T19:06:03.050Z (5 months ago)
- Topics: box-shadow, image, shadow
- Language: JavaScript
- Homepage:
- Size: 662 KB
- Stars: 12
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
shadowizer
A cli tool for adding box shadow to images
![]()
npm i -g shadowizerBefore
![]()
After
![]()
## Usage
See `shadowizer --help` for more details.
### shadowizer [root]
Find images and add box shadow to them. You can specify the root directory, which can be an absolute path, or a path relative to the current working directory. Default to `process.cwd()`.
It should be noted that all images with added shadows will be output in `png` format to the `shadowizer-{timestamp}` directory in the root directory.
> Why not other output formats such as `jpeg`, because png supports transparency.
| Options | Description |
| ---------------------- | :--------------------------------------------------------------------------- |
| `-f, --files` | specify images, support glob patterns, default: `\*.{png,jpg,jpeg,webp}` |
| `-c, --shadowColor` | set shadow color, default: `#00000073` |
| `-b, --shadowBlur` | set shadow blur, default: `25` |
| `-x, --shadowOffsetX` | set shadow offset x, default: `0` |
| `-y, --shadowOffsetY ` | set shadow offset y, default: `0` |Example:
```sh
# specify directory to find images
shadowizer path/to# specify multiple images
shadowizer -f text.png -f fun.png# specify images with glob patterns
shadowizer -f *.png# set shadow color
shadowizer -c #00000073
```## API
### addShadow
- type: `(imagePath: string, shadow?: ShadowOptions) => Promise`
Adds a box shadow to the specified image.
```js
import { addShadow } from 'shadowizer'
```### saveShadowImage
- type: `(imagePath: string, outDir?: string, shadow?: ShadowOptions) => Promise`
Adds a box shadow to the specified image and saves it to disk.
```js
import { saveShadowImage } from 'shadowizer'
```## License
[MIT](./LICENSE) © alex.wei