This project has moved and is read-only. For the latest updates, please go here.

How do I use ImageMagick.Percentage and .TextAlignment?

Mar 23 at 3:10 AM
Edited Mar 23 at 3:11 AM
I can't seem to assign it a percentage.
I am trying to create a text watermark over an image.
Your code works in a drawing example you have.

I would like to make the font opaque so the viewer can still see the photo, but not use it. Intellisense gives me .FillOpacity(percentage) and .StrokeOpactity(percentage) but it won't take a number for percentage.

Also, how would I move the text to the middle of the image? It is currently centered but up at the top.
                new Drawables()
                  // Draw text on the image
                  .FontPointSize(72)
                  .FillOpacity()
                  .Font("Comic Sans")
                  .StrokeColor(new MagickColor("yellow"))
                  .StrokeOpacity()
                  .FillColor(MagickColors.Orange)
                  .TextAlignment(TextAlignment.Center)
                  .Text(256, 64, "Magick.NET")
                  // Add an ellipse
                  .StrokeColor(new MagickColor(0, Quantum.Max, 0))
                  .FillColor(MagickColors.SaddleBrown)
                  .Ellipse(256, 96, 192, 8, 0, 360)
                  .Draw(image);
Mar 23 at 4:29 AM
Percentage is a struct that has no implicit cast from a number to percentage so you will need to do it yourself. Either "new Percentage(20)" or "(Percentage) 20". If you want the text on the middle of your page it might be easier to create an image with just the text and Composite that on top of your image. You could also change the alpha value for each pixel in the image so you can still see the text.
Mar 25 at 2:40 AM
Edited Mar 25 at 2:41 AM
hmmm. I got it to work with .FillColor("white") and .FillOpacity(New Percentage(50))
did away with the stroke and elipse and adjusted location using .Text(x=somenumber, y=somenumber,"Magick.NET")

Works good. Probably will mosey over to paypal and send you some money since I plan to use it.
I was waiting to see if anyone replied, didn't get an email.
Mar 25 at 4:25 AM
Not sure what you mean by "I was waiting to see if anyone replied, didn't get an email.". If you want to send me something through paypal please contact me through CodePlex and I will tell you where u can send it. You are not obligated to donate something when you use my library though. You are free to use it in a commercial product without giving me anything.
Mar 26 at 5:00 AM
I just donated $30. Well worth it.
Mar 26 at 6:53 AM
I have not yet shared my PayPal details with you? You gave it to the wrong person?