Re: scaling text
[email protected] ("R. Hicks")
| Newsgroups | perl.beginners |
|---|---|
| Message-ID | <[email protected]> |
zentara wrote: > 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 have been reading a bit. Would it be easy to just create the text as an image and then scale that according to its bounding box? Robert