in reply to Re^2: Using text data in GD(or other)
in thread Using text data in GD(or other)

You're already using File::Slurp, so
write_file( 'test_image.jpg', {binmode => ':raw' }, $image->jpeg) ; write_file( 'test_image2.gif', {binmode => ':raw' }, $image->gif) ;