Page 1 of 1

Cyrillic text from the image

Posted: 2012-04-04T03:43:18-07:00
by YouPict.Ru
Hi all!

Cyrillic text from the image. My decision.

Code: Select all

use Encode;
use Image::Magick;
$image = Image::Magick->new;
$image->Border(width=>1, height=>1, bordercolor=>'black');
$text = 'Текст кириллица';
$text = encode("utf8", decode("cp1251", $text));
$image->Annotate(font=>'arial.ttf', pointsize=>18, fill=>'green', gravity=>'center', text=>$text);
$image->Set (compression=>'JPEG', quality=>80);
$image->Write ("name.jpg");

Re: Cyrillic text from the image

Posted: 2012-04-05T01:24:16-07:00
by anthony
The handling for cyrillic text to UTF8 in perl is useful to know!

But the text into that first assignment already appears to be utf8, persumably because you posted it on a utf8 website :-)