motumbo wrote:btw not sure if this is the appropriate channel but the -shadow itself introduces some artifacts when the sigma value is high, mostly notable with light backgrounds (high contrast between the shadow and the background)
the reason for this is that the amount of added extra space for the blur is set to only 2x the sigma. really it should be three.
For small blurs 2x is fine whcih was why I used in in my original request for a -shadow operator so long ago. But for larger sigmas you can start to see some artifacts as you report.
See the shadow equivalence example...
http://www.ict.griffith.edu.au/anthony/ ... _internals
One solution is to add your own extra border (transparent) around the original image before generating the shadow.
A better variation is to add that extra border to the clone image and then add a relative negative offset adjustment to keep it aligned.
For example..
Code: Select all
\( +clone -alpha set -bordercolor none -border 10 -repage -10-10! \
-shadow .... \)
yes it is a pain but it will do the job.
Another solution is to fix the shadow operator itself to add a 3x border internally, of course that does then mean ALL shadow generated images will actually be much larger for all usage.
I would however prefer to keep the amount of border that is added to be fixed. If I didn't mind a variable border addition I could make the border dependant on the internally calculated radius used for -blur 0x{sigma} operations, though it tends to be far larger than is typically visible and also becomes variable relative to the IM's compile time Quality setting.
Hmm one improvement. Blur and thus shadow is actually a linear operation, but when used on sRGB images (whcih is a non-linear colorspace), it will appear much darker than it actually should.
To correct this add
-channel A -gamma 2.2 +channel immediately after the -shadow operation. Better still, wrapper the layer composition with
-colorspace sRGB -layers merge -colorspace RGB
Either method will greatly reduce the darknesss of the semi-transparent areas of the shadow and make it behave more correctly in terms of Human Color Perception
http://www.imagemagick.org/Usage/color_ ... perception