I don't get the expected results when saving as jpg. Here is the decription from the source for better understanding.
-- IM SHADOW WITH UMBRA + PREUMBRA AREA
-- 1. create preumbra mask as base for shadow
-- 2. create preumbra shadow
-- 3. add 1px full transparent border (simply avoids PDF render problems at graphic borders)
-- 4. create umbra mask
-- 5. create umbra shadow
-- 6. get opaque channels (black) of preumbra shadow and colorize it if needed
-- 7. combine transparent channels of both shadows
-- 8. combine the opaque (non transparent and unicolored) graphic with the shadow graphic
-- 9. save shadow
And here are the command lines from the batch file (only the last line differs). The first command creates a png graphic
and the second one creates a jpg graphic.
Windows
Code: Select all
convert ( -size 310x210 -density 150 xc:none -fill black -stroke none -strokewidth 0 -draw "roundrectangle 1,1 308,208 19,19" ) ^
( +clone -background black -shadow 40x9+0+0 +repage ) ^
( +clone -matte -mattecolor "#00000000" -frame 1 +repage -write mpr:preumbra ) -delete 0-2 ^
( -size 302x202 -density 150 xc:none -fill black -stroke none -strokewidth 0 -draw "roundrectangle 1,1 300,200 15,15" ) ^
( +clone -background black -shadow 100x2+0+0 +repage -write mpr:umbra ) -delete 0-1 ^
( mpr:preumbra -channel Opacity ) ^
( -gravity center -channel Alpha mpr:preumbra mpr:umbra -compose lighten -composite -blur 0x2.0 ) ^
( -gravity center -compose copy_opacity -composite ) ^
-units PixelsPerInch -set density 150 -quality 95 +set date:create +set date:modify -colorspace gray "test.png"
convert ( -size 310x210 -density 150 xc:none -fill black -stroke none -strokewidth 0 -draw "roundrectangle 1,1 308,208 19,19" ) ^
( +clone -background black -shadow 40x9+0+0 +repage ) ^
( +clone -matte -mattecolor "#00000000" -frame 1 +repage -write mpr:preumbra ) -delete 0-2 ^
( -size 302x202 -density 150 xc:none -fill black -stroke none -strokewidth 0 -draw "roundrectangle 1,1 300,200 15,15" ) ^
( +clone -background black -shadow 100x2+0+0 +repage -write mpr:umbra ) -delete 0-1 ^
( mpr:preumbra -channel Opacity ) ^
( -gravity center -channel Alpha mpr:preumbra mpr:umbra -compose lighten -composite -blur 0x2.0 ) ^
( -gravity center -compose copy_opacity -composite ) ^
-units PixelsPerInch -set density 150 -quality 95 -background white -alpha remove -colorspace gray "test.jpg"
Code: Select all
convert \( -size 310x210 -density 150 xc:none -fill black -stroke none -strokewidth 0 -draw "roundrectangle 1,1 308,208 19,19" \) \
\( +clone -background black -shadow 40x9+0+0 +repage \) \
\( +clone -matte -mattecolor "#00000000" -frame 1 +repage -write mpr:preumbra \) -delete 0-2 \
\( -size 302x202 -density 150 xc:none -fill black -stroke none -strokewidth 0 -draw "roundrectangle 1,1 300,200 15,15" \) \
\( +clone -background black -shadow 100x2+0+0 +repage -write mpr:umbra \) -delete 0-1 \
\( mpr:preumbra -channel Opacity \) \
\( -gravity center -channel Alpha mpr:preumbra mpr:umbra -compose lighten -composite -blur 0x2.0 \) \
\( -gravity center -compose copy_opacity -composite \) \
-units PixelsPerInch -set density 150 -quality 95 +set date:create +set date:modify -colorspace gray "test.png"
convert \( -size 310x210 -density 150 xc:none -fill black -stroke none -strokewidth 0 -draw "roundrectangle 1,1 308,208 19,19" \) \
\( +clone -background black -shadow 40x9+0+0 +repage \) \
\( +clone -matte -mattecolor "#00000000" -frame 1 +repage -write mpr:preumbra \) -delete 0-2 \
\( -size 302x202 -density 150 xc:none -fill black -stroke none -strokewidth 0 -draw "roundrectangle 1,1 300,200 15,15" \) \
\( +clone -background black -shadow 100x2+0+0 +repage -write mpr:umbra \) -delete 0-1 \
\( mpr:preumbra -channel Opacity \) \
\( -gravity center -channel Alpha mpr:preumbra mpr:umbra -compose lighten -composite -blur 0x2.0 \) \
\( -gravity center -compose copy_opacity -composite \) \
-units PixelsPerInch -set density 150 -quality 95 -background white -alpha remove -colorspace gray "test.jpg"
Version: ImageMagick 6.7.8-8 2012-08-04 Q16 on Windows7