Converting Hebrew font to image looks like GIBBERISH
Converting Hebrew font to image looks like GIBBERISH
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 !
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 !
- 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
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
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
Re: Converting Hebrew font to image looks like GIBBERISH
First, thanks for the quick reply !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
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 !
Re: Converting Hebrew font to image looks like GIBBERISH
exec("convert -list format") will run the command system("convert -list format") will run the command and display the output.
- 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
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
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
Re: Converting Hebrew font to image looks like GIBBERISH
Weird, it still not working for me ... do you think it has something to do with the HOSTING company and the IM version ?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
should i ask of the hosting company to upgrade the IM version, will it help ??
10x !
- 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
What is not working? With or without the -direction?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 ??
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.
- 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
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)fmw42 wrote:I am not sure whether or not you can use wild cards in both the input and output.
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/
https://imagemagick.org/Usage/
Re: Converting Hebrew font to image looks like GIBBERISH
Hi !fmw42 wrote:What is not working? With or without the -direction?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 ??
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.
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 !
- 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
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: 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.
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.
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
The result came out as follows, with the hebrew text reversed to what I have on the command line.
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/
https://imagemagick.org/Usage/
Re: Converting Hebrew font to image looks like GIBBERISH
The image that you uploded is correct !!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: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 textCode: Select all
convert -pointsize 18 pango:'This is english.\nBut this is hebrew -> ניסיון' pango_hebrew.png
The result came out as follows, with the hebrew text reversed to what I have on the command line.
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.
did you use this
Code: Select all
convert -pointsize 18 pango:'This is english.\nBut this is hebrew -> ניסיון' pango_hebrew.png
version ?
- 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
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?
What version of IM are you using?
Re: Converting Hebrew font to image looks like GIBBERISH
Hello again !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?
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.
Re: Converting Hebrew font to image looks like GIBBERISH
Did you install pango-devel? The header files are required to build ImageMagick with Pango support. Type
- cd ImageMagick-6.7.9-9
./configure
- PANGO --with-pango=yes yes
- make clean
make
make install
Re: Converting Hebrew font to image looks like GIBBERISH
Hi,magick wrote:Did you install pango-devel? The header files are required to build ImageMagick with Pango support. Type
The configure script output should say:
- cd ImageMagick-6.7.9-9
./configure
If so, go ahead with
- PANGO --with-pango=yes yes
- make clean
make
make install
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