For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > January 2006 > Image::Magick Annotate









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Image::Magick Annotate
S Khadar

2006-01-10, 4:01 am

Hi all,

I am using IM as a part of my work. I have one strange - yet simple problem
-
I used these code in my program

$ima->Annotate(fill=>'red', font=>'Generic.ttf', primitive=>'string',x
=>"35", y => "30", pointsize=>'40', text=>"FU FU ~ FU FOOOO server");

but the option Annotate is not working for me at all - rest is working fine..
I am using a Redhat/i386 machine and Image::Magick 6.2.4. Should I have to

do i need to install anything more or how can i display the annotate option
???

Please help !!!
THANKS IN ADVANCE

S K

Zentara

2006-01-10, 4:01 am

On Wed, 28 Dec 2005 04:03:34 -0800, ibiokid@gmail.com (S Khadar) wrote:

>Hi all,
>
>I am using IM as a part of my work. I have one strange - yet simple problem
>-
>I used these code in my program
>
>$ima->Annotate(fill=>'red', font=>'Generic.ttf', primitive=>'string',x
>=>"35", y => "30", pointsize=>'40', text=>"FU FU ~ FU FOOOO server");
>
>but the option Annotate is not working for me at all - rest is working fine.
>I am using a Redhat/i386 machine and Image::Magick 6.2.4. Should I have to
>
>do i need to install anything more or how can i display the annotate option
>???


This works for me on linux, and it has translucent text too!
########################################
###################
#!/usr/bin/perl
use warnings;
use strict;
use Image::Magick;

# original code by Grandfather at
# http://perlmonks.org?node_id=492171

my $imagein = shift || '1Zen16.png';

my $image = Image::Magick->new ();
my $over = Image::Magick->new();

$image->ReadImage ($imagein);
$over->Set(size=> "1200x200");
$over->ReadImage('xc:#808080'); # Nochange colour for Hardlight
my $err = $over->Annotate
(
pointsize => 200,
text => 'Hello World',
gravity=>'center',
stroke => '#C0C0C0', # Increase to make stroke more white
fill => '#505050', # Decrease to make fill more black
# font => '@C:/WINDOWS/Fonts/times.TTF', # Omit for default font
);
print $err if $err;

$image->Composite (compose=>'Hardlight',
image=>$over,gravity=>'center');
$image->Write ("$0.jpg");



--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com