use strict; use warnings; use GD::SecurityImage; my $image = GD::SecurityImage->new( width => 420, height => 100, ptsize => 30, lines => 30, scramble => 1, thickness => 1, gd_font => 'giant', bgcolor => '#eeeeee', font => '/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif.ttf', send_ctobg => 1, ); my @rand = ( { rand => 10, plus => 48 }, { rand => 25, plus => 65 }, { rand => 25, plus => 97 }, ); my $string = (); for (0..5) { my $r = rand(@rand); $string .= chr(rand($rand[$r]{rand})+$rand[$r]{plus}); } $image->random($string); # method, style, text_color, line_color $image->create(qw/ttf rect #660000 #eeeeee/); $image->particle(600); my ($image_data, $mime_type, $random_number) = $image->out(force => 'png'); print "Content-Type: image/$mime_type\n\n"; print $image_data;