Hi,
I'm trying to generate an image based on a text string with PerlMagick, but can't seem to get it working. This is to be used as a verification code for securing a web form. Here's the code:
#!/usr/bin/perl
use Image::Magick;
$image = Image::Magick->new;
$image->Set(size=>'150x50');
$image->ReadImage('xc:white');
$text = "This is a test";
$image->Annotate(pointsize=>40, fill=>'red', text=>$text);
print "Content-type: image/gif\n\n";
print $image->Write('gif:-');
Whenever I run the script through the browser, all I see are a couple of thin red lines (no text).
I've searched all over the Internet but can't seem to find any clear explanation on how to use this Annotate method.
Any help will be greatly appreciated.
Thanks,
Ralph
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.