Re: scaling text

[email protected] (zentara)
Newsgroups perl.beginners
Message-ID <[email protected]>
On Mon, 19 May 2008 14:37:27 -0400, [email protected] (Robert L Hicks)
wrote:

>Is there an algorithm to scale text on a graphic? I have a badge 200x200 
>that I would like to scale text on.
>
>I have looked at a bunch of Perl image libraries ( o_O ) but I didn't 
>see an example.
>
>Robert

Play around with annotate's point size and other settings.
If you need realtime zooming, you will need to go to a canvas,
like Tk::Canvas, Tk::Zinc, or Gnome2::Canvas


#!/usr/bin/perl -w
use strict;
use Image::Magick;

my $image = Image::Magick->new;
$image->Set(size=>'250x100');
$image->Read('1Zen16.jpg');  #load your badge

my $text = "This is a test";

$image->Annotate(
     pointsize=>40, 
     text=>$text, 
     stroke => '#C0C0C0', # Increase to make stroke more white
     fill => '#505050', #or red etc, Decrease to make fill more black
     gravity => 'center',
      x=> -10, # offsets
      y=> -10  # offsets
     );

print $image->Write("$0.png");
__END__


zentara
-- 
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.