Converting Hebrew font to image looks like GIBBERISH

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?".
hezhez
Posts: 12
Joined: 2012-04-30T10:58:44-07:00
Authentication code: 13

Converting Hebrew font to image looks like GIBBERISH

Post by hezhez »

Hi !

i'm LOST !

I'm trying to convert *.SVG file to *.JPG, the SVG file contains Image + Text(with hebrew fonts), the conversions goes with the following command:

exec("convert *.svg *.jpg");

The conversion creates new JPG file with the image and text but the text looks like GIBBERISH.

It's important to mention that the fonts looks fine if i runs the *.SVG file for it self, the GIBBERISH turns out after the conversion at the last result - *.JPG


What am i doing wrong ?

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

Re: Converting Hebrew font to image looks like GIBBERISH

Post by fmw42 »

I am not sure whether or not you can use wild cards in both the input and output. Nevertheless, here are a couple of things to consider.

1) use one specific image and test that both in PHP exec and in the command line. does it even work with one image in the command line in a terminal rather than in PHP exec

2) do you have SVG or RSVG insalled, type the following:

convert -list format

see what it says for SVG, here is my line which shows I have RSVG delegate library installed. It is likely more flexible that the IM SVG


SVG SVG rw+ Scalable Vector Graphics (RSVG 2.34.2)

3) you might post a link to your svg file so others can test
hezhez
Posts: 12
Joined: 2012-04-30T10:58:44-07:00
Authentication code: 13

Re: Converting Hebrew font to image looks like GIBBERISH

Post by hezhez »

fmw42 wrote:I am not sure whether or not you can use wild cards in both the input and output. Nevertheless, here are a couple of things to consider.

1) use one specific image and test that both in PHP exec and in the command line. does it even work with one image in the command line in a terminal rather than in PHP exec

2) do you have SVG or RSVG insalled, type the following:

convert -list format

see what it says for SVG, here is my line which shows I have RSVG delegate library installed. It is likely more flexible that the IM SVG


SVG SVG rw+ Scalable Vector Graphics (RSVG 2.34.2)

3) you might post a link to your svg file so others can test
First, thanks for the quick reply !

I have test it again at is basic for of conversion:

exec("convert -background white -fill black -size 320x320 -encoding Unicode -font Arial -gravity center \
-direction right-to-left -pointsize 40 label:'ניסיון' test01.png");

and still, it turns out GIBBERISH even with out the image, only TEXT.

BTW, exec("convert -list format") - gave me nothing, what does it means ?

Thanks !
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Converting Hebrew font to image looks like GIBBERISH

Post by Bonzo »

exec("convert -list format") will run the command system("convert -list format") will run the command and display the output.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Converting Hebrew font to image looks like GIBBERISH

Post by fmw42 »

It seems to be broken with the -direction in my IM 6.7.6.8 Q16 Mac OSX Snow Leopard. What version of IM are you using?

This works, but the text is not right-to-left


convert -background white -fill black -encoding Unicode -font Arial -gravity center \
-pointsize 40 label:'ניסיון' show:


But this gives only a white image, no black text.


convert -background white -fill black -encoding Unicode -font Arial -gravity center \
-direction right-to-left -pointsize 40 label:'ניסיון' show:

I have posted a bug report at viewtopic.php?f=3&t=20884
hezhez
Posts: 12
Joined: 2012-04-30T10:58:44-07:00
Authentication code: 13

Re: Converting Hebrew font to image looks like GIBBERISH

Post by hezhez »

fmw42 wrote:It seems to be broken with the -direction in my IM 6.7.6.8 Q16 Mac OSX Snow Leopard. What version of IM are you using?

This works, but the text is not right-to-left


convert -background white -fill black -encoding Unicode -font Arial -gravity center \
-pointsize 40 label:'ניסיון' show:


But this gives only a white image, no black text.


convert -background white -fill black -encoding Unicode -font Arial -gravity center \
-direction right-to-left -pointsize 40 label:'ניסיון' show:

I have posted a bug report at viewtopic.php?f=3&t=20884
Weird, it still not working for me ... do you think it has something to do with the HOSTING company and the IM version ?

should i ask of the hosting company to upgrade the IM version, will it help ??

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

Re: Converting Hebrew font to image looks like GIBBERISH

Post by fmw42 »

Weird, it still not working for me ... do you think it has something to do with the HOSTING company and the IM version ?

should i ask of the hosting company to upgrade the IM version, will it help ??
What is not working? With or without the -direction?

I found that without the -direction right-to-left, that it works, but the letters are in the wrong direction. I believe that some of this has been fixed relatively recently and thought the direction was working. But it seems not.

Again what version of IM are you using. If old, then perhaps you at least need an upgrade. But if the right-to-left is not working then I would wait until it is fixed and get that version.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Converting Hebrew font to image looks like GIBBERISH

Post by anthony »

fmw42 wrote:I am not sure whether or not you can use wild cards in both the input and output.
In the above the shell expands BOTH input and output arguemnts, before IM even executes. As such Im only sees the alphabetically last filename as the 'write'. As it is JPG, it will write using multiple files (with numbers added to teh filenames)
See File Handling, Writing Multiple Images, Adjoin
http://www.imagemagick.org/Usage/files/#adjoin

Even if you quote the two arguments IMv6 will still expand both 'glob-expansions' in the same way shell does, and produce the same results. This is for DOS usage as DOS does not do glob expansions itself, but leaves it up to the program.

IMv7 (as I have it currently written) limits 'glob-expansion' to just reading images, and not globally over the whole command line. As such in IMv7, quoting the two expressions will result in it writing files with '*' characters in the output filenames as the second argument is not 'glob-expanded' This is on purpose, and better reflects the arguments it is given. It means later IM changes may be able to substitute '*' more intelligently (or perhaps not).

I am also thinking of adding a special setting to allow users to make input filenames 'literal' and not process them for coders, globs, or read_mods. This would be used more for security reasons to avoid matching multiple files when a script or program does not want it to.

This reminded me that I needed to add this to the 'porting' doc. DONE :-)
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
hezhez
Posts: 12
Joined: 2012-04-30T10:58:44-07:00
Authentication code: 13

Re: Converting Hebrew font to image looks like GIBBERISH

Post by hezhez »

fmw42 wrote:
Weird, it still not working for me ... do you think it has something to do with the HOSTING company and the IM version ?

should i ask of the hosting company to upgrade the IM version, will it help ??
What is not working? With or without the -direction?

I found that without the -direction right-to-left, that it works, but the letters are in the wrong direction. I believe that some of this has been fixed relatively recently and thought the direction was working. But it seems not.

Again what version of IM are you using. If old, then perhaps you at least need an upgrade. But if the right-to-left is not working then I would wait until it is fixed and get that version.
Hi !

The conversion with and without the -direction gives me the GIBBERISH at the final result(the *.jpg),

My IM version is 6.6.3, do you think it has anything to do with the version ? And if so, how are the fonts conversion related to

that, at the end it all comes down to encoding, no ?

Thanks !
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Converting Hebrew font to image looks like GIBBERISH

Post by anthony »

First do not use *.jpg for the final filename -- it will overwrite the LAST jpg file in the directory.

Second the new coder "pango" will automatically handle language direction changes and even mixed language.

For example:

Code: Select all

   convert -pointsize 18 pango:'This is english.\nBut this is hebrew -> ניסיון' pango_hebrew.png
NOTE: when I type this on my command line the hebrew characters are in the opposite order. So I believe the web browser is also reversing the text :-)


The result came out as follows, with the hebrew text reversed to what I have on the command line.
Image

Is this a correct image?

Pango Text to Image Conversion (requires at least IM v6.7.6-3)
http://www.imagemagick.org/Usage/text/#pango


But you are right when I try this with the default font
convert -direction right-to-left -pointsize 18 label:'ניסיון' show:
I get gibberish. Most likely is that the default font itself is not correctly defined for hebrew.
Do you have a TTF with hebrew unicode glyphs font we can try it with?

NOTE label: uses very simplistic low level font rendering with very little understanding of special unicode glyphs. Pango on the other hand is a much higher level renderer (with little to no font selection control) that does understand unicode glyph handling and its consequences.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
hezhez
Posts: 12
Joined: 2012-04-30T10:58:44-07:00
Authentication code: 13

Re: Converting Hebrew font to image looks like GIBBERISH

Post by hezhez »

anthony wrote:First do not use *.jpg for the final filename -- it will overwrite the LAST jpg file in the directory.

Second the new coder "pango" will automatically handle language direction changes and even mixed language.

For example:

Code: Select all

   convert -pointsize 18 pango:'This is english.\nBut this is hebrew -> ניסיון' pango_hebrew.png
NOTE: when I type this on my command line the hebrew characters are in the opposite order. So I believe the web browser is also reversing the text :-)


The result came out as follows, with the hebrew text reversed to what I have on the command line.
Image

Is this a correct image?

Pango Text to Image Conversion (requires at least IM v6.7.6-3)
http://www.imagemagick.org/Usage/text/#pango


But you are right when I try this with the default font
convert -direction right-to-left -pointsize 18 label:'ניסיון' show:
I get gibberish. Most likely is that the default font itself is not correctly defined for hebrew.
Do you have a TTF with hebrew unicode glyphs font we can try it with?

NOTE label: uses very simplistic low level font rendering with very little understanding of special unicode glyphs. Pango on the other hand is a much higher level renderer (with little to no font selection control) that does understand unicode glyph handling and its consequences.
The image that you uploded is correct !! :)

did you use this

Code: Select all

convert -pointsize 18 pango:'This is english.\nBut this is hebrew -> ניסיון' pango_hebrew.png
to do it ?? because it is not working for me, it shows the english characters but not the hebrew - it's beacuse of the IM

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

Re: Converting Hebrew font to image looks like GIBBERISH

Post by fmw42 »

Pango Text to Image Conversion (requires at least IM v6.7.6-3) and you must install Pango delegate

What version of IM are you using?
hezhez
Posts: 12
Joined: 2012-04-30T10:58:44-07:00
Authentication code: 13

Re: Converting Hebrew font to image looks like GIBBERISH

Post by hezhez »

fmw42 wrote:Pango Text to Image Conversion (requires at least IM v6.7.6-3) and you must install Pango delegate

What version of IM are you using?
Hello again !

So i finally installed the latest version of IM, but when i'm trying to use the pango it says something about the "no decode delegate for this image format ..."

Can you explain please how do i install the "Pango" ?

BR,
Hezi.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Converting Hebrew font to image looks like GIBBERISH

Post by magick »

Did you install pango-devel? The header files are required to build ImageMagick with Pango support. Type
  • cd ImageMagick-6.7.9-9
    ./configure
The configure script output should say:
  • PANGO --with-pango=yes yes
If so, go ahead with
  • make clean
    make
    make install
hezhez
Posts: 12
Joined: 2012-04-30T10:58:44-07:00
Authentication code: 13

Re: Converting Hebrew font to image looks like GIBBERISH

Post by hezhez »

magick wrote:Did you install pango-devel? The header files are required to build ImageMagick with Pango support. Type
  • cd ImageMagick-6.7.9-9
    ./configure
The configure script output should say:
  • PANGO --with-pango=yes yes
If so, go ahead with
  • make clean
    make
    make install
Hi,

It says PANGO --with-pango=yes no

[Update] - I Checked and pango-devel is install with latest version.

But when i'm trying to use the "PANGO" it still gives me "no decode delegate for this image format..." , what should i do ?


Thanks !
Hezi
Post Reply