open(PNG,"test.png"); $im = newFromPng GD::Image(PNG); $white = $im->colorClosest(255,255,255); # find white $im->transparent($white); binmode STDOUT; print $im->png;