in reply to Would GD draws in command line

As command lines are typically text-based, you need to pass the image data to something that can handle it, e.g. ImageMagick's display command:

$ ./youscript.pl | display -

(In case there are issues with autodetecting the image format, you can say something like gif:- instead of just - (the dash stands for stdin). This prefixing is specific to ImageMagick, though)