How create persian or arabic text with imgaemagick ?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
mostafanastary
Posts: 44
Joined: 2014-11-28T16:19:41-07:00
Authentication code: 6789

How create persian or arabic text with imgaemagick ?

Post 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
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How create persian or arabic text with imgaemagick ?

Post by snibgo »

Just put your text in a command, with "-annotate" or another mechanism. See my page http://im.snibgo.com/snutf8.htm
snibgo's IM pages: im.snibgo.com
mostafanastary
Posts: 44
Joined: 2014-11-28T16:19:41-07:00
Authentication code: 6789

Re: How create persian or arabic text with imgaemagick ?

Post by mostafanastary »

Hi,
can you put complete command line for سلام ?

thank you
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How create persian or arabic text with imgaemagick ?

Post 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
mostafanastary
Posts: 44
Joined: 2014-11-28T16:19:41-07:00
Authentication code: 6789

Re: How create persian or arabic text with imgaemagick ?

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How create persian or arabic text with imgaemagick ?

Post by fmw42 »

Notepad does not support UTF8 (unicode). You need to create the text in a unicode compatible text editor.
mostafanastary
Posts: 44
Joined: 2014-11-28T16:19:41-07:00
Authentication code: 6789

Re: How create persian or arabic text with imgaemagick ?

Post by mostafanastary »

if i want to get text from input form, what do i do?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How create persian or arabic text with imgaemagick ?

Post 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.
mostafanastary
Posts: 44
Joined: 2014-11-28T16:19:41-07:00
Authentication code: 6789

Re: How create persian or arabic text with imgaemagick ?

Post by mostafanastary »

do you get any result with arabix text?
can you tell me one of the unicode compatible text editor?

thank you
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How create persian or arabic text with imgaemagick ?

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How create persian or arabic text with imgaemagick ?

Post by fmw42 »

mostafanastary
Posts: 44
Joined: 2014-11-28T16:19:41-07:00
Authentication code: 6789

Re: How create persian or arabic text with imgaemagick ?

Post 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
mostafanastary
Posts: 44
Joined: 2014-11-28T16:19:41-07:00
Authentication code: 6789

Re: How create persian or arabic text with imgaemagick ?

Post 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?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How create persian or arabic text with imgaemagick ?

Post by fmw42 »

-font /fullpath2/some_font_name.ttf
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How create persian or arabic text with imgaemagick ?

Post 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
snibgo's IM pages: im.snibgo.com
Post Reply