open(IMG, '>file.gd2') or die $!; binmode IMG; print IMG $gd->gd2;