open OUT,">$ID.png"; binmode OUT; print OUT $im->png; close OUT; #### #!/usr/bin/perl use strict; use warnings; use GD; use GD::Image; my $im_width = 1000; my $im_height = 1000; my $im = GD::Image->newTrueColor($im_width, $im_height); my $white = $im->colorAllocate(255,255,255); my $black = $im->colorAllocate(0,0,255); my $red = $im->colorAllocate(255,0,0); my $blue = $im->colorAllocate(0,0,255); $im->rectangle(0,0,99,99,$black); $im->arc(50,50,95,75,0,360,$blue); $im->fill(50,50,$red); my $pngdata = $im->png; open (DISPLAY,"| display -") || die; binmode DISPLAY; print DISPLAY $pngdata; close DISPLAY;