my $blob = $image->ImageToBlob(); #now your image is in the scalar $blob and you can gzip it #and write it out to file any way you can get to work