public void writeImage(OutputStream os, FileFormatOption fileFormatOption, String debugData) throws IOException {
		final FileFormat fileFormat = fileFormatOption.getFileFormat();
		if (fileFormat == FileFormat.PNG) {
			final BufferedImage im = createImage();
			PngIO.write(im, os, null, 96, debugData);
		} else if (fileFormat == FileFormat.SVG) {
			final UGraphicSvg svg = new UGraphicSvg(colorMapper, StringUtils.getAsHtml(colorMapper
					.getMappedColor(background)), false, 1.0);
			drawAndGetSize(svg);
			svg.createXml(os);
		} else if (fileFormat == FileFormat.ATXT || fileFormat == FileFormat.UTXT) {
			final UGraphicTxt txt = new UGraphicTxt();
			drawAndGetSize(txt);
			txt.getCharArea().print(new PrintStream(os));
		} else if (fileFormat == FileFormat.EPS) {
			final UGraphicEps ug = new UGraphicEps(colorMapper, EpsStrategy.getDefault2());
			drawAndGetSize(ug);
			os.write(ug.getEPSCode().getBytes());
		} else {
			throw new UnsupportedOperationException();
		}
	}