I have a .png file with a transparent background containing a letter-like symbol:
I'd like to use Imagemagick to add a bevel to this symbol, such as can be done in Photoshop (with depth of 7 and a 45deg angle):
I've tried using the -shade, -emboss, and -raise parameters in imagemagick to no avail:
magick Fplain.png -shade 120x45 Fshaded.png
magick Fplain.png -emboss 0x.5 Fembossed.png
magick Fplain.png -raise 7 Fraised.png
These commands yield the following images, respectively:
Surely I can accomplish what I want in Imagemagick, but I just as surely need some help.
I can do that with my bash unix Imagemagick script, bevel, as follows. Pad the image with transparency. Run the bevel script. Shave the excess padding. (See bevel )
Input:
convert img.png -bordercolor none -border 10 tmp.png
bevel -w 5 -f inner -i hard -s 0 -a 120 -e 45 tmp.png tmp.png
convert tmp.png -shave 10x10 result.png
Result:
ADDITION
Here is the code in bash scripting that will reproduce the results above:
width=5
wfact=$((1000*$width))
leveling="-level 0,$wfact"
depth=100
icontr=`convert xc: -format "%[fx:(0.5*$depth-100)]" info:`
ocontr=`convert xc: -format "%[fx:(0.5*$depth-100)]" info:`
ideepening="-brightness-contrast 0,$icontr"
odeepening="-brightness-contrast 0,$ocontr"
convert img.png -bordercolor none -border 10x10 -write mpr:img \
-alpha extract -write mpr:alpha \
+level 0,1000 -white-threshold 999 \
-morphology Distance:-1 Euclidean:$width,1000 $leveling \
-shade 120x45 -auto-level $ideepening \
\( +clone -fill "gray(50%)" -colorize 100% \) +swap \( mpr:alpha -threshold 0 \) \
-compose over -composite \
\( mpr:img -alpha off \) +swap -compose hardlight -composite \
mpr:alpha -alpha off -compose copy_opacity -composite \
-shave 10x10 \
img_bevel.png