This project has moved. For the latest updates, please go here.

strokeColor in Magick Script

May 26, 2015 at 2:55 PM
Hello all,

I just discovered Magick Script and i'm face an error with the property strokeColor in Draw.

Here is my script
<msl xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="MagickScript.xsd">
      <read>
      <draw>
        <gravity gravity="Southwest"/>
                 <pointSize pointSize="20"/>
                  <text value="Hello my name is Jerome" x="0"  y="20" />
              <strokeColor color="#00000080"/>
        </draw>
        </read>
</msl>
If i remove the stroke color property, it works.
How can i add text with color ? What i am doing wrong ?

Thank you for your help.

Jerome
Coordinator
May 26, 2015 at 10:13 PM
What is the error that you are receiving? You should specify the strokeColor before you draw the text if you want to change the color:
<msl xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="MagickScript.xsd">
  <read>
  <draw>
    <gravity gravity="Southwest"/>
      <pointSize pointSize="20"/>
      <strokeColor color="#00000080"/>
      <text value="Hello my name is Jerome" x="0"  y="20" />
    </draw>
  </read>
</msl>
May 27, 2015 at 7:52 AM
Thanks for the reply. I tried your version but the result is the same.

The error :
An unhandled exception of type 'System.StackOverflowException' occurred in Magick.NET.Wrapper-x86.dll


My C# code (sScript contains the xml)
The exeption is thrown by oScript.Execute()

// Load resize script and execute it
MagickScript oScript = new MagickScript(new MemoryStream(Encoding.UTF8.GetBytes(_sScript ?? "")));

 // Event that will be raised when the script wants to read a file
 oScript.Read += OnScriptRead;
                        
 // Execute the script
 oScript.Execute();
May 27, 2015 at 10:05 AM
Hello,

I tried with the object annotate and the following XML works
<msl xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="MagickScript.xsd">
  <read>
      <fontPointsize value="20"/>
  <font value="Arial"/>
  <fillColor value="#FFFFFF"/>
  <annotate text="test by Jerome" boundingArea="0x0+0+10"  gravity="South"/>
  </read>
</msl>
Coordinator
May 29, 2015 at 3:01 PM
Thanks for coming back to the topic. My example probably works if you set 'fillColor' instead of 'strokeColor' also. And how did you resolve the stackoverflow problem?
Jun 1, 2015 at 8:42 AM
You're right, this works if i use 'fillColor' instead of 'strokeColor'.

The stackoverflow is caused by 'strokeColor' inside the tag "draw", i can reproduce each time i use it.

Nevertheless, my problem is fixed and i have two solutions :
  • using draw and fillcolor
  • using annotate
Thanks for the help.