Quantcast
Channel: magick Discussions Rss Feed
Viewing all articles
Browse latest Browse all 3693

New Post: Arabic Annotation in an Image - Disconnected Letters

$
0
0
I am trying to annotate an image with Arabic text, but unfortunately, the letters are shown disconnected. I tried changing the text encoding, but the result does not change. Also, the text direction did not work with me when I tried setting it to "TextDirection.RightToLeft". The text still shows from left to right which is not correct in Arabic language.

However, when I use the Graphics class and DrawString method (in native ASP.NET), I get Arabic text correctly with no issues in encoding. But the issue with this approach is that I lose the image resolution and sometimes I get an image double the size of its original.

I would really appreciate if you could help me in resolving this encoding issue in Magick.NET.

I am using the code shown below.

Regards,
Menhal



using (MagickImageCollection images = new MagickImageCollection())
{
MagickImage logo = new MagickImage("logo:");
images.Add(logo);

MagickImage label = new MagickImage();
label.BackgroundColor = Color.Black;
label.FillColor= Color.White;
label.TextDirection = TextDirection.RightToLeft;
label.TextGravity = Gravity.East;
label.TextEncoding = Encoding.Unicode;
label.Read("label:" + "مرحبا بكم");
label.Extent(logo.Width, label.Height, Gravity.East);
images.Add(label);

using (MagickImage output = images.AppendVertically())
{
output.Write("output-b.png");
}
}

Viewing all articles
Browse latest Browse all 3693

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>