public static void main(String[] args) {
        Options options = new Options();

        CommandLineParser parser = new GnuParser();
        try {
            CommandLine result = parser.parse(options, args);
            byte[] rawdata = null;
            ByteArrayOutputStream baos = null;
            try {
                baos = new ByteArrayOutputStream();
                StreamHelper.streamCopy(System.in, baos);
                rawdata = baos.toByteArray();
            } catch (IOException ex) {
                Logger.getLogger(ImageCreatorMain.class.getName()).log(Level.SEVERE, null, ex);
                System.exit(-1);
            } finally {
                StreamHelper.closeQuietly(baos);
            }
            
            ImageCreator creator = new ImageCreator();
            BufferedImage image = creator.createImageFromData(rawdata);
            ImageIO.write(image, "jpg", System.out);

        } catch (ParseException ex) {
            logger.log(Level.SEVERE, "Error parsing command line.", ex);
            System.exit(-1);
        } catch (IOException ex) {
            Logger.getLogger(ImageCreatorMain.class.getName()).log(Level.SEVERE, null, ex);
            System.exit(-1);
        }

    }