2

I am trying to convert an SVG file via Batik to TIFF. In the SVG File all the color values are defined as device-cmyk. The SVG looks like this:

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
  <path d="M30,1h40l29,29v40l-29,29h-40l-29-29v-40z" stroke="#CD853F device-cmyk(0.11, 0.48, 0.83, 0.00)" fill="#CD853F device-cmyk(0.11, 0.48, 0.83, 0.00)"/>
</svg>

I am using TIFFTranscoder to create the files:

byte[] bytes = svgFileAsString.getBytes("UTF-8");
ByteArrayInputStream byteInputStream = new ByteArrayInputStream(bytes);
TranscoderInput transcoderInput = new TranscoderInput(byteInputStream);
ByteArrayOutputStream byteOutputStream = new ByteArrayOutputStream();
TranscoderOutput transcodeOutput = new TranscoderOutput(byteOutputStream);
TIFFTranscoder tiffConverter = new TIFFTranscoder();
tiffConverter.transcode(transcoderInput, transcodeOutput);
byteOutputStream.flush();
byteOutputStream.close();
FileUtils.writeByteArrayToFile(new File("svgtiff.tiff"), byteOutputStream.toByteArray());

After creation the TIFF file only contains the RGB values. Does anyone knows how to define what color-model the TIFF should use?

XleKle
  • 73
  • 6

0 Answers0