in reply to Re: Icon generation on the fly
in thread Icon generation on the fly
It is a little bit weird (my be this is not the right font for this) but it works.use Imager; my $icon_width=128; my $icon_height=128; my $image = Imager->new(xsize => $icon_width, ysize => $icon_height); $image->box( xmin=>0, ymin=>0, xmax=>$icon_width-1, ymax => $icon_height-1, filled => 1, color => '#ffffff' ); my $font_filename = 'C:/Windows/Fonts/arialbd.ttf'; my $font = Imager::Font->new(file=>$font_filename) or die "Cannot loa +d $font_filename: ", Imager->errstr; print "Enter number: ";my $text=<>;chomp($text); my $text_size = 96; $font->align( string => $text, size => $text_size, color => '#000000', x => $image->getwidth/2, y => $image->getheight/2, halign => 'center', valign => 'center', image => $image ); $image->write(file=>'number.ico') or die 'Cannot save image: ', $image +->errstr;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Icon generation on the fly
by Khen1950fx (Canon) on Jan 31, 2012 at 19:31 UTC | |
by chessgui (Scribe) on Feb 01, 2012 at 05:36 UTC |