Page 1 of 1

Image shadow and relative layers position

Posted: 2011-12-11T11:41:14-07:00
by spok
I have an image for which I add a shadow.
Of course adding the shadow will increase the final image dimensions, but I'd like to know the relative position of the original image inside the final image (dx and dy shift). Is this possible ?

Re: Image shadow and relative layers position

Posted: 2011-12-11T11:49:44-07:00
by fmw42
see http://www.imagemagick.org/script/comma ... php#shadow and http://www.imagemagick.org/Usage/blur/#shadow

The negative of +X+Y should tell you the offsets to your original, if I am not mistaken

Re: Image shadow and relative layers position

Posted: 2011-12-11T12:50:24-07:00
by spok
Thanks but it not what I'm looking for.
For instance you can specify an offset of 10,10 which makes the shadow looks at right bottom.
However, depending on the sigma value (the blur effect) the dimensions of the shadow layer may include completely the original image layer because the blur makes the shadow extents in all directions.

Re: Image shadow and relative layers position

Posted: 2011-12-11T14:10:01-07:00
by fmw42
Only other suggestion is to do a compare of the original image with the larger shadowed image and it will tell you the offset.

see
http://www.imagemagick.org/script/compare.php
viewtopic.php?f=1&t=14613&p=51076&hilit ... ric#p51076

In the latter, with current versions of IM, one must add -subimage-search.

Re: Image shadow and relative layers position

Posted: 2011-12-11T14:49:16-07:00
by spok
Well may be I should explain more precisely what I want to do. May be there is another solution to do it.
After adding the shadow to the image, I'd like to extend the canvas of the resulted image, keeping the initial image centered in the canvas.

If I just do the extent after the shadow, then the whole image (initial+shadow) will be centered but the initial image will not.

That's why I need the offset between the image layer and the shadow layer, so I can extend the canevas with such values to have the initial picture centered in the canvas.

Re: Image shadow and relative layers position

Posted: 2011-12-11T15:24:17-07:00
by fmw42

Re: Image shadow and relative layers position

Posted: 2011-12-11T16:28:09-07:00
by spok
Thank you !