...also see Image and Text Watermarked Letters and#!/usr/bin/perl use warnings; use strict; use Image::Magick; #usage: script baseimage overlayimage text my $image = Image::Magick->new; my $oimage = Image::Magick->new; my $rc = $image->Read('1Zen16.jpg'); $rc = $oimage->Read('overlay.png'); my $text = "\nlooking for nirvana\n :-)\n"; $rc = $image->Composite( geometry => '+30+30', compose=>'Atop', image => $oimage, opacity => '100%', tile => 0, ); $image->Annotate(pointsize => 36, fill => '#ffcc00ff', #last 2 digits opacity in hex ff=ma +x text => $text, gravity => 'South' ); $image->Write("$0.png"); exit;
#!/usr/bin/perl -w use strict; use Image::Magick; =comment my $text = 'test'; my $im = new Image::Magick; $im->Read("meteo.jpg"); my $rv = $im->Annotate( text => $text, font => 'C:\\WINDOWS\\Fonts\\Arial.ttf', x => 10, y => 10, ); die("Unable to annotate image: $rv\n") if "$rv"; print "Content-type: image/jpeg\n\n"; binmode STDOUT; print $im->Write('jpeg:-'); =cut my $image = Image::Magick->new; $image->Set(size=>'250x100'); $image->Read('1Zen16.jpg'); 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");
In reply to Re: Perl GD problem with colors for text
by zentara
in thread Perl GD problem with colors for text
by natol44
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |