Page 1 of 1

eliminating the offset when using blur in a shadow

Posted: 2010-12-19T14:56:48-07:00
by javismiles
im doing shadows in image texts successfully, the problem comes when i use enough blur , like x4 or x5, then the resulting image jumps from the previous one,
i read that +repage is supposed to reset the offset, but it doesnt seem to work
in the latest version, other people saying the same, any tips?

basically i need that the original image, and the new image with the drop shadow, stay in the same place, so that there is no offset when the shadow
has a blur value

thank u very much

Re: eliminating the offset when using blur in a shadow

Posted: 2010-12-19T15:02:29-07:00
by javismiles
this is the command i use

convert -background none -fill #ffffff -font Arial -pointsize 100 -rotate 0 -gravity West label:"text" ( -clone 0 -background black -shadow 100x1+2+2 ) -reverse -background none -layers merge +repage result.png

it works great, but the resulting image moves with an offset from its previous position, i just need to eliminate that offset created by the Blur setting of the shadow

thank you very much

Re: eliminating the offset when using blur in a shadow

Posted: 2010-12-19T16:10:14-07:00
by javismiles
im having another problem

when using Rotate mixed with shadow in that command, only the shadow rotates, not the image,
how could i solve this?

convert -background none -fill #ffffff -font Arial -pointsize 100 -rotate 90 -gravity West label:"text" ( -clone 0 -background black -shadow 100x1+2+2 ) -reverse -background none -layers merge result.png

thank u very much

Re: eliminating the offset when using blur in a shadow

Posted: 2010-12-19T16:31:01-07:00
by javismiles
i have managed to do the rotate well now, just moving the rotate to the end of command

so only problem i have left is that the shadow that has blur generates a bigger result image than the shadow that has no blur, is there a way to generate the same
sized image with and without blur in the shadow?

Re: eliminating the offset when using blur in a shadow

Posted: 2010-12-19T19:37:55-07:00
by anthony
The image moved because you removed the 'negative' offset that -layers merge generated in order to properly align both images together correctly without clipping the negative parts of the image.

Replace the -layers merge with -mosaic, and the negative offset will be ignored (and clipped). No need for the +repage either.
This is explained in IM Examples, Shadows and the Offset Problem
http://www.imagemagick.org/Usage/blur/#shadow_offset

If the original image has enough padding to take the generated shadow (without too much clipping) then using DstOver composition (to underlay the shadow) is the best method to use.

Code: Select all

  convert rose: -bordercolor None -border 10x10 \
          \( +clone -background navy -shadow 80x3+5+5 \) \
          -compose DstOver -composite -compose Over  shadow_space.png
This example "shadow of a padded image" has been added the above location.


Layer methods in summery...
-layer merge expands the first image bounds in all directions (including negatives)
-mosaic only expands in positive directions and include origin (0,0)
-flatten just uses the size of the first images virtual canvas.
-composite two images only, destination image size preserved

See ImageMagick Usage Examples, Layering Images
http://www.imagemagick.org/Usage/layers/#flatten

Re: eliminating the offset when using blur in a shadow

Posted: 2010-12-20T01:16:26-07:00
by javismiles
Anthony , this is fantastic help, it works,
thank you very much,
your explanations are always so detailed and well explained,
you really help people a lot in this forum, thank you so much :)
Jav
;)