$png_data = $image->png; open (OUTFILE,"imagewithtext.png"); binmode OUTFILE; print OUTFILE $png_data; close OUTFILE;