Rotation/Distortion after stroking text weirdness

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
dgpatterson

Rotation/Distortion after stroking text weirdness

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Rotation/Distortion after stroking text weirdness

Post by fmw42 »

try setting -virtual-pixel background -background white
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Rotation/Distortion after stroking text weirdness

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
rmabry
Posts: 148
Joined: 2004-04-13T11:25:27-07:00

Re: Rotation/Distortion after stroking text weirdness

Post 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
dgpatterson

Re: Rotation/Distortion after stroking text weirdness

Post 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
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Rotation/Distortion after stroking text weirdness

Post 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!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Rotation/Distortion after stroking text weirdness

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply