Page 1 of 2

How create persian or arabic text with imgaemagick ?

Posted: 2014-11-30T04:32:22-07:00
by mostafanastary
Hi,
I read every post in internet also Imagemagick forum and in the end, i can't find a way to write Persian Or Arabic language text with imagemagick.
i see the pango and my server administrator told me, it is old and without any new update,

Is there any help for my problem?

Now, i create my text with php and gd with png file and composite that over my images.

API: php
Server: Linux
imagemagick version: lasted

thank you

Re: How create persian or arabic text with imgaemagick ?

Posted: 2014-11-30T04:40:41-07:00
by snibgo
Just put your text in a command, with "-annotate" or another mechanism. See my page http://im.snibgo.com/snutf8.htm

Re: How create persian or arabic text with imgaemagick ?

Posted: 2014-11-30T04:51:36-07:00
by mostafanastary
Hi,
can you put complete command line for سلام ?

thank you

Re: How create persian or arabic text with imgaemagick ?

Posted: 2014-11-30T13:52:56-07:00
by fmw42
You can do this

convert -size 200x200 xc:white -fill black -font Arial -gravity center -annotate +0+0 "سلام" result.jpg

But if you copy and paste, the text must come from a UTF8 compatible text editor and the font must support UTF8 (unicode) characters. See
http://www.imagemagick.org/Usage/text/#unicode

Re: How create persian or arabic text with imgaemagick ?

Posted: 2014-11-30T15:00:08-07:00
by mostafanastary
Hi fred

my result with your code with copy and paste is:
Image

and with type myself is like it too:

Image

i write سلام in notepad or notepad++ and copy and paste in code but result is like that too,

Image

i create input form:

<form action="1.php" method="post" id="MyUploadForm" >
<input type="text" class="text" name="text" maxlength="20"/>
<input type="submit" id="submit-btn" value="Send" />
</form>

and type سلام and sent it, but result same.
Image


type with arabic and persian language in imagemagick is very important, because 26 country with arabic lang and over 5 country with persian.
please help me

best regards.

Re: How create persian or arabic text with imgaemagick ?

Posted: 2014-11-30T15:06:03-07:00
by fmw42
Notepad does not support UTF8 (unicode). You need to create the text in a unicode compatible text editor.

Re: How create persian or arabic text with imgaemagick ?

Posted: 2014-11-30T15:13:28-07:00
by mostafanastary
if i want to get text from input form, what do i do?

Re: How create persian or arabic text with imgaemagick ?

Posted: 2014-11-30T17:14:15-07:00
by fmw42
Your form software would have to support Unicode characters and the person posting to the form would have to use Unicode character set when typing into or pasting into the form. That has nothing to do with Imagemagick. You would have to post this question to some other forum or ask the ISP for your web site if that is supported.

Re: How create persian or arabic text with imgaemagick ?

Posted: 2014-11-30T17:25:01-07:00
by mostafanastary
do you get any result with arabix text?
can you tell me one of the unicode compatible text editor?

thank you

Re: How create persian or arabic text with imgaemagick ?

Posted: 2014-11-30T17:37:07-07:00
by fmw42
I do not know how to create arabic text. My text editor is BBEDIT, but is a Mac based editor. Perhaps you need a special font for arabic. See http://www.fontspace.com/category/arabic

Re: How create persian or arabic text with imgaemagick ?

Posted: 2014-11-30T17:41:46-07:00
by fmw42

Re: How create persian or arabic text with imgaemagick ?

Posted: 2014-11-30T17:43:01-07:00
by mostafanastary
ok ok ok,
i will try it, but i think, imagemagick developer must think about some change to create a library for arabic text.

thank you

Re: How create persian or arabic text with imgaemagick ?

Posted: 2014-11-30T18:04:41-07:00
by mostafanastary
can i use my own font for this command line?

if i put the some_font_name.ttf in the folder of my code, what is the code for execute my font?

Re: How create persian or arabic text with imgaemagick ?

Posted: 2014-11-30T20:07:32-07:00
by fmw42
-font /fullpath2/some_font_name.ttf

Re: How create persian or arabic text with imgaemagick ?

Posted: 2014-11-30T21:45:51-07:00
by snibgo
For Arabic text with ImageMagic, "caption:" and "label:" can be used, with "-direction right-to-left". However, this selects glyphs for standalone characters, not joined-up characters.

The easiest solution seems to be "pango:", where "-direction right-to-left" is not needed.

Code: Select all

convert -gravity Center -size 200x200 -fill black -font Arial -pointsize 50 pango:"سلام" arabic_r5.png
Image