Page 1 of 1

Rotation/Distortion after stroking text weirdness

Posted: 2009-01-13T09:33:09-07:00
by dgpatterson
Using ImageMagick 6.4.8 2008-12-27 Q16 on Windows Vista 64-bit

I am not sure if this is a bug or not, but when trying to Arc Distort an image after stroking text, I get these interesting little "trails" off of the edges and bottoms of some text. The appearance of the trails seems to depend on the font face, font size, stroke width, and the actual letter or character and its position in the string. It appears that the letters are being rendered with a few "extra" pixels and so when it is distorted they get stretched out. I want them to not be there :)

test line:

convert -background "none" -fill "blue" -font "c:\windows\fonts\arial.ttf" -pointsize 72 -gravity "center" -rotate 180 -distort Arc "30 180" -strokewidth 2 -stroke "red" label:"asdfdfgygyfsffggggg" -trim +repage

I've tried switching antialiasing on and off to no avail, amongst other various little changes.

So, like I said, I'm not 100% that this is a bug, but I've searched high and low and couldn't find anyone talking about this. So any advice is greatly appreciated.

example pic included
Image

Re: Rotation/Distortion after stroking text weirdness

Posted: 2009-01-13T17:45:26-07:00
by fmw42
try setting -virtual-pixel background -background white

Re: Rotation/Distortion after stroking text weirdness

Posted: 2009-01-13T22:02:46-07:00
by anthony
The colors: transparent, black, white and gray; can be set directly as well. for example -virtual-pixels white, -background however must be used if you want some other color.

See IM Examples,
http://www.imagemagick.org/Usage/misc/#virtual

You also could have looks at the specific examples of using Arc Distortion...
http://www.imagemagick.org/Usage/distorts/#arc
Which does talk about this and even uses this effect to generate some interesting images.

Re: Rotation/Distortion after stroking text weirdness

Posted: 2009-01-14T20:48:53-07:00
by rmabry
"try setting -virtual-pixel background -background white"

What he said. But "-virtual-pixel background" works fine for me without the "-background white". ( 6.4.4 2008-10-19 Q16 and 6.4.8-6 2009-01-11 Q16 )

Cool bug/feature.

Rick

Re: Rotation/Distortion after stroking text weirdness

Posted: 2009-01-15T12:23:02-07:00
by dgpatterson
Hi there!

Thanks for the suggestions. Before I saw these responses, I tried messing around with the virtual pixel to no avail. I need the image on the transparent background, so had to keep that in there, and just couldn't seem to find the right combination. But I did find a solution!

-bordercolor none -border 1

Doing this before the -distort prevented the 'extra' pixels from touching the edge of the image, which it turns out was what caused the 'trails' to appear when those areas were distorted by the Arc. By putting this small buffer on there it gets rid of the trails. A quick -trim +repage at the end cleans everything up nicely.

Thanks again for the suggestions!

-daniel

Re: Rotation/Distortion after stroking text weirdness

Posted: 2009-01-15T23:00:35-07:00
by anthony
rmabry wrote:"What he said. But "-virtual-pixel background" works fine for me without the "-background white". ( 6.4.4 2008-10-19 Q16 and 6.4.8-6 2009-01-11 Q16 )
Default background color is white, when the image read in did not have such a setting. GIF and PNG images do!

Re: Rotation/Distortion after stroking text weirdness

Posted: 2009-01-15T23:03:07-07:00
by anthony
dgpatterson wrote:-bordercolor none -border 1
As mentioned the default -virtual-pixel setting is 'edge' so naturally setting the edge color will have the same effect as setting a -virtual-pixel 'some color' (background or one of the specials).

I hit appon the same solution before virtual-pixel was implemented in IM.
For -displacement, -blur, and -fx effects. -distortion was added after -virtual-pixel.