Page 1 of 1

Outline bug with stroke

Posted: 2017-08-02T05:21:44-07:00
by Dombi
Hello from Germany again.

I use ImageMagick 6.8.9-9 and I want create an outline text. But after a few letters this (see the picture) happens:
https://www.servietten-deko.de/images/outline.png

These are my code lines:

Code: Select all

$stokewidthcmd=' -strokewidth '.$this->padding.' -stroke "#'.$this->outlinecolor.'"';

system('convert -depth '.$this->imagedepth.' -density '.$this->dpi.' -units pixelsperinch -background transparent -gravity '.$this->gravity.' -fill "#'.$this->fore.'" -font '.$this->font' -strokewidth '.$this->padding.' -stroke "#'.$this->outlinecolor.'" ' -pointsize '.$this->size.' label:"'.$this->msg.'" '.WWW_ROOT.IMAGES_URL.'editorimages/1_'.$pngName);

system('composite -gravity center '.WWW_ROOT.IMAGES_URL.'editorimages/'.$pngName.' '.WWW_ROOT.IMAGES_URL.'editorimages/1_'.$pngName.' '.WWW_ROOT.IMAGES_URL.'editorimages/'.$pngName);
Here you can try it live (press the great buttan then create a new text with outline/Umrandung):
https://www.servietten-deko.de/servietten-bedrucken.php

Can someone please help me?

PS: Sorry for my bad english.

Re: Outline bug with stroke

Posted: 2017-08-02T09:43:03-07:00
by fmw42
When using label: and putting two text colors, try using -gravity center

Re: Outline bug with stroke

Posted: 2017-08-02T12:12:28-07:00
by Dombi
Thank you. But in line 2 and 3 is a "-gravity center"

Re: Outline bug with stroke

Posted: 2017-08-02T12:31:31-07:00
by Bonzo
Have you tried a simple piece of code with fixed values to see what the result is?

Re: Outline bug with stroke

Posted: 2017-08-02T13:27:54-07:00
by Dombi
Yes i tried:

Code: Select all

system('convert -depth 32 -density 300 -units pixelsperinch -background transparent -gravity center -fill "#ffffff" -font arial -strokewidth 2 -stroke "#006abc" -pointsize 4 label:"fgdfg fdgfdgggggggg" '.WWW_ROOT.IMAGES_URL.'editorimages/1_'.$pngName);
... same result.

If I change the font, then the error comes earlier or later in the text.

Re: Outline bug with stroke

Posted: 2017-08-02T13:37:04-07:00
by Bonzo
I do not see how you can tell at -pointsize 4 :D

Anyway works OK for me with -pointsize 10 & 20 in whatever version of convert I have in V7; also worked OK using magick. I suppose the suggestion will be to upgrade or try a different version.

Should also say I used the command line.

Re: Outline bug with stroke

Posted: 2017-08-02T13:45:50-07:00
by Dombi
I cant change the version. My provider decides this. Here it is ImageMagick 6.8.9-9 Q16.

PS: -pointsize 4 is a good size. 20 is very big, here.

Re: Outline bug with stroke

Posted: 2017-08-02T14:12:32-07:00
by Bonzo
Just tried it on my server ( Version: ImageMagick 6.9.4-10 Q16 x86_64 2017-05-23 ) as well and it works OK - you might have a problem if you can not get your hosts to upgrade.

Image

With -pointsize 4 I was just getting blue blobs.

Re: Outline bug with stroke

Posted: 2017-08-03T05:46:52-07:00
by Dombi
Thank you. But I found the solution:

The line only works without the "-units pixelsperinch" tag. Strange, but true. :-)