Goal: to add drop shadow to images.
- ImageMagick docs, Generating Shadows, https://www.imagemagick.org/Usage/blur/#shadow
- ImageMagick docs, Layering Multiple Images, https://www.imagemagick.org/Usage/layers/#layers
To add drop shadows use following set of instructions:
magick <input-image> ^ ^( +clone -background #11111e -shadow percent-opacityxBlur}+shiftX+shiftY ^) ^ +swap -background none -layers merge <output-image>
The above code also does work for irregular shapes so we may expect it to get good results for prettified counters, too:
magick input\prettyA.png ^( +clone -background #11111e -shadow 60x0+4+4 ^) ^ +swap -background none -layers merge output\output.png
input-fileand adds it to image sequence;
-background #11111esets the shadow colour;
-shadow 60x0+4+4generates shadow, 60% opaque, non-blurred (
Blur), shifted by 4 pixels horizontally and vertically;
+swapswaps images in the image sequence;
-background nonesets background transparent;
-layers mergecombines both images into one, expanding the canvas if required, so that it is big enough to fit all images with set offsets. In our case, the canvas will be big enough to accommodate the image and its shadow (which we shifted by 4 pixels with respect to original image).