Good documentation or good source examples for Image::Magick or converterfrom commandline to perl

Good documentation or good source examples for Image::Magick or converterfrom commandline to perl

am 01.04.2008 23:23:24 von nntpman68

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

Re: Good documentation or good source examples for Image::Magickor converter from commandline to p

am 02.04.2008 00:04:16 von Frank Seitz

nntpman68 wrote:
>
> 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

I know the problem.
http://imagemagick.org/script/perl-magick.php
At least you find the possible parameters there.

Frank
--
Dipl.-Inform. Frank Seitz; http://www.fseitz.de/
Anwendungen für Ihr Internet und Intranet
Tel: 04103/180301; Fax: -02; Industriestr. 31, 22880 Wedel

Re: Good documentation or good source examples for Image::Magickor converter from commandline to per

am 02.04.2008 00:07:15 von nntpman68

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
>
>

Re: Good documentation or good source examples for Image::Magickor converter from commandline to p

am 02.04.2008 00:13:31 von nntpman68

Thanks a lot Frank,


That's also the one, which I found and tried to understand.

Any perl script displaying a text with the Image::Magick::Draw method
would solve my current problem.

Perhaps I manage to google for an example, though I didn't get a useful
hit so far


bye

N


Frank Seitz wrote:
> nntpman68 wrote:
>> 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
>
> I know the problem.
> http://imagemagick.org/script/perl-magick.php
> At least you find the possible parameters there.
>
> Frank

Re: Good documentation or good source examples for Image::Magick or converter from commandline to

am 02.04.2008 00:54:47 von John Bokma

nntpman68 wrote:

> Thanks a lot Frank,

Post top please not do

> That's also the one, which I found and tried to understand.
>
> Any perl script displaying a text with the Image::Magick::Draw method
> would solve my current problem.

There is a security image (CAPTCHA) module - GD::SecurityImage - on CPAN
that can use Image::Magick. I am not sure if that has a good example of
what you want to achieve though.

--
John

http://johnbokma.com/perl/

Re: Good documentation or good source examples for Image::Magickor converter from commandline to per

am 02.04.2008 02:04:43 von glex_no-spam

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/

Re: Good documentation or good source examples for Image::Magick or converter from commandline to pe

am 02.04.2008 05:30:53 von David Harmon

On Wed, 02 Apr 2008 00:07:15 +0200 in comp.lang.perl.misc, nntpman68
wrote,
>$err = $tile->Draw( %textopts );
>warn "$err" if "$err";
>
>Produces the message:
>Exception 410: unrecognized option `text' at ./test.pl line 103.

draw "text" is no longer supported in recent versions of
ImageMagick; annotate must be used instead.

Re: Good documentation or good source examples for Image::Magickor converter from commandline to per

am 02.04.2008 08:39:17 von nntpman68

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/

Re: Good documentation or good source examples for Image::Magickor converter from commandline to per

am 02.04.2008 08:43:29 von nntpman68

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/

Re: Good documentation or good source examples for Image::Magick or

am 02.04.2008 15:12:10 von w.c.humann

On Apr 2, 12:13=A0am, nntpman68 wrote:
>
> Perhaps I manage to google for an example, though I didn't get a useful
> hit so far
>

Hope you're using the right search tool in google for code-search,
e.g. like this:

http://www.google.com/codesearch?hl=3Den&q=3D%22use+Image%3A %3AMagick%22+%22=
-%3EAnnotate%22+text%5Cs%2A%3D%3E+lang:perl

Wolfram