Uploaded image for project: 'Batik'
  1. Batik
  2. BATIK-595

ImageTranscoder fails with certain SVG image with embedded URL

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Resolution: Fixed
    • 1.6
    • None
    • Bridge
    • None
    • Operating System: other
      Platform: Other

    Description

      With a specific svg image file the ImageTranscoder throws a BridgeException of
      malformed URL. The transcoder works properly if the FileInputStream is sent
      directly to the transcoder. In the client implementation this is not an
      option since the SVG has been previously serialized to a byte array for
      caching. (see attached svg).

      // create a JPEG transcoder
      JPEGTranscoder t = new JPEGTranscoder();

      FileInputStream fis = new FileInputStream("C:
      test7.svg");
      int size = fis.available();
      byte[] svgBuffer = new byte[size];

      fis.read(svgBuffer);
      fis.close();

      // set the transcoding hints
      t.addTranscodingHint(JPEGTranscoder.KEY_QUALITY,
      new Float(.8));
      // create the transcoder input
      InputStream in = new ByteArrayInputStream(svgBuffer);

      TranscoderInput input = new TranscoderInput(in);

      // create the transcoder output
      OutputStream ostream = new FileOutputStream("C:
      test7.jpg");
      TranscoderOutput output = new TranscoderOutput(ostream);
      // save the image
      t.transcode(input, output);
      // flush and close the stream then exit
      ostream.flush();
      ostream.close();

      Attachments

        1. test7.svg
          1 kB
          Steven Shaw

        Activity

          People

            batik-dev@xmlgraphics.apache.org Batik Developer's Mailing list
            steveshaw@ca.ibm.com Steven Shaw
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: