A cli tool for adding box shadow to images
npm i -g shadowizer
Before
After
See shadowizer --help
for more details.
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:
# 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
- type:
(imagePath: string, shadow?: ShadowOptions) => Promise<void | Buffer>
Adds a box shadow to the specified image.
import { addShadow } from 'shadowizer'
- type:
(imagePath: string, outDir?: string, shadow?: ShadowOptions) => Promise<boolean>
Adds a box shadow to the specified image and saves it to disk.
import { saveShadowImage } from 'shadowizer'
MIT © alex.wei