Hello!
Help me please, i have problem with encoding in labels!
try to use example http://www.imagemagick.org/Usage/thumbnails/
Adding Borders
and i aad label "Россия" (russian language) and get the following :
problem in the coding or in the font?
how to write label or caption on russian?
labels text encoding
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: labels text encoding
You need to match the text encoding with the font. Typically you use a Unicode text with Unicode font.
The characters that appears on the image look like Unicode 'meta' characters, rather that a simpler 8-bit text format using russian meta characters (8-bit codes > 127).
You can use a command such as "iconv" on many machines to convert from practically any text format to some other text format (like unicode). I myself have used it to convert chinese 'gb' text to unicode for printing purposes.
A newer version of "iconv" is known as "recode"
In perl you can use something like the "Encode" library module.
( I have no idea where I got this last from originally, I just saved it for future use).
The characters that appears on the image look like Unicode 'meta' characters, rather that a simpler 8-bit text format using russian meta characters (8-bit codes > 127).
You can use a command such as "iconv" on many machines to convert from practically any text format to some other text format (like unicode). I myself have used it to convert chinese 'gb' text to unicode for printing purposes.
A newer version of "iconv" is known as "recode"
In perl you can use something like the "Encode" library module.
Code: Select all
use Encode;
$text = 'Текст кириллица';
$text = encode("utf8", decode("cp1251", $text));
print "$text\n";
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: labels text encoding
very thank you!
$mystr='тестовая строка';
it is option work good in php!
$mystr='тестовая строка';
Code: Select all
$mystr = iconv("windows-1251", "utf-8", $mystr);
$run = exec('convert thumbnail.gif \
-bordercolor black -border 3 -bordercolor white -border 2 \
\( -background black -fill white -pointsize 24 \
label:'.$mystr.' -trim +repage \
-bordercolor black -border 10 \
\) -gravity South -append \
-bordercolor black -border 10 -gravity South -chop 0x10 \
border_framework.gif',$out,$err);