|
Prev: Good documentation or good source examples for Image::Magickor converter from commandline to perl
Next: What is best CMS - SilverStripe, Joomla or Drupal
From: nntpman68 on 1 Apr 2008 18:07 Hi, I'm still not succeeding with drawing a text :-( . Following attempt doesn't produce any text, put doesn't print any error / warning: my %textopts = ( primitive => 'text' , stroke => 'red' , pointsize => 12 , points => "20,20" ); $err = $g->Draw( %textopts ); warn "$err" if "$err"; whereas following command (with same %textopts as above) $err = $tile->Draw( %textopts ); warn "$err" if "$err"; Produces the message: Exception 410: unrecognized option `text' at ./test.pl line 103. The only doc, that I found: http://www.imagemagick.org/script/perl-magick.php seems to indicate, that the option is 'text' > Draw primitive=>{point, line, rectangle, arc, ellipse, circle, path, polyline, polygon, bezier, color, matte, text, @filename}, points=>string , method=>{Point, Replace, Floodfill, FillToBorder, Reset}, stroke=>color name, fill=>color name, font=>string, pointsize=>integer, strokewidth=>float, antialias=>{true, false}, bordercolor=>color name, x=>float, y=>float, dash-offset=>float, dash-pattern=>array of float values, affine=>array of float values, translate=>float, float, scale=>float, float, rotate=>float, skewX=>float, skewY=>float, interpolate=>{undefined, average, bicubic, bilinear, mesh, nearest-neighbor, spline}, text=>string, vector-graphics=>string annotate an image with one or more graphic primitive What am I overlooking? bye N nntpman68 wrote: > Hi, > > Normally CPAN documentation is quite good. > > However I'm having some problems with ImageMagick. > > Could anybody point me to some good concise documentation. > > Reading the Imagemagick documentation and guestimating how to pass the > same parameters to the perl equivalemt is not always simple: > > Example: > > Assume following ImageMagic command: > > convert -size 64x64 xc:transparent -pointsize 10 -draw "text 0,20 > 'hello'" test.png > > > I'd like to do the same in perl: > > my $g = Image::Magick->new; > $g->Set(size=>"64x64"); > $g->ReadImage('xc:transparent'); > $g->Draw( primitive => 'text', BUT_WHAT_IS_THE_SYNTAX_HERE_???? ); > $g->Write("test.png"); > > and don't really know where to look. > > > Any hint / document is welcome > > > bye > > N > >
From: J. Gleixner on 1 Apr 2008 20:04 nntpman68 wrote: > Hi, > > I'm still not succeeding with drawing a text :-( . > > > Following attempt doesn't produce any text, put doesn't print any error > / warning: Of course, you didn't provide anything for it to 'Draw'. :-) > > my %textopts = ( > primitive => 'text' , > stroke => 'red' , > pointsize => 12 , > points => "20,20" > ); > > $err = $g->Draw( %textopts ); > warn "$err" if "$err"; > > > whereas following command (with same %textopts as above) > > $err = $tile->Draw( %textopts ); > warn "$err" if "$err"; > > Produces the message: > Exception 410: unrecognized option `text' at ./test.pl line 103. I guess $tile and $g aren't the same class. Try either of these: $obj->Annotate( x => 0, y => 20, text => 'Blah' ); $obj->Draw( primitive => 'Text', points => '0,20 "Blah"' ); Graphics Programming with Perl http://www.manning.com/verbruggen/
From: nntpman68 on 2 Apr 2008 02:39 Thanks a lot. This was just a typo. however it also didn't work when I used $g on both places. bye N J. Gleixner wrote: > nntpman68 wrote: >> Hi, >> >> I'm still not succeeding with drawing a text :-( . >> >> >> Following attempt doesn't produce any text, put doesn't print any >> error / warning: > > Of course, you didn't provide anything for it to 'Draw'. :-) > >> >> my %textopts = ( >> primitive => 'text' , >> stroke => 'red' , >> pointsize => 12 , >> points => "20,20" >> ); >> >> $err = $g->Draw( %textopts ); >> warn "$err" if "$err"; >> >> >> whereas following command (with same %textopts as above) >> >> $err = $tile->Draw( %textopts ); >> warn "$err" if "$err"; >> >> Produces the message: >> Exception 410: unrecognized option `text' at ./test.pl line 103. > > I guess $tile and $g aren't the same class. > > Try either of these: > > $obj->Annotate( > x => 0, > y => 20, > text => 'Blah' ); > > $obj->Draw( > primitive => 'Text', > points => '0,20 "Blah"' ); > > Graphics Programming with Perl > http://www.manning.com/verbruggen/
From: nntpman68 on 2 Apr 2008 02:43
Hi J, I tried both of your examples. With my version of Image::Magick both work. Excellent. Thanks a lot :-) Looking at David Harmon's reply it seems better to stick with annotate. I'll do so. bye N J. Gleixner wrote: > nntpman68 wrote: >> Hi, >> >> I'm still not succeeding with drawing a text :-( . >> >> >> Following attempt doesn't produce any text, put doesn't print any >> error / warning: > > Of course, you didn't provide anything for it to 'Draw'. :-) > >> >> my %textopts = ( >> primitive => 'text' , >> stroke => 'red' , >> pointsize => 12 , >> points => "20,20" >> ); >> >> $err = $g->Draw( %textopts ); >> warn "$err" if "$err"; >> >> >> whereas following command (with same %textopts as above) >> >> $err = $tile->Draw( %textopts ); >> warn "$err" if "$err"; >> >> Produces the message: >> Exception 410: unrecognized option `text' at ./test.pl line 103. > > I guess $tile and $g aren't the same class. > > Try either of these: > > $obj->Annotate( > x => 0, > y => 20, > text => 'Blah' ); > > $obj->Draw( > primitive => 'Text', > points => '0,20 "Blah"' ); > > Graphics Programming with Perl > http://www.manning.com/verbruggen/ |