#!/usr/bin/perl use warnings; use strict; use GD; GD::Image->trueColor(1); my $img_file = 'zzrgbwb.png'; my $gd = GD::Image->new($img_file) or die; my ($w, $h) = $gd->getBounds(); print "$w $h\n"; # allocate some colors my $white = $gd->colorAllocate(255,255,255); my $black = $gd->colorAllocate(0,0,0); my $red = $gd->colorAllocate(255,0,0); my $green = $gd->colorAllocate(0,255,0); my $blue = $gd->colorAllocate(0,0,255); # make the background transparent and interlaced $gd->transparent($green); #$gd->interlaced('true'); open(GD, ">zzrgbwb-gt.png") or die; binmode GD; print GD $gd->png; close GD;