Hi,

 

   I have a code like A.) below and failed on processing a SVG line like B.) below in a SVG input file.

C.) is the failed message dumped from exception handler and D.) is the failed point when I trace the code.

 

   Because JPEGImageDecoder comes from "com.sun.org.apache.*"; so that I can't trace further. I traced all codes

before creating the broken link image Graphics node (from PURL) and seem fine. The classpath setting for resource

RegistrEntry has no problem. I am wondering wheter you can help me on this issue.

 

   Also, because JPEGImageDecoder has no source code, I can't exactly identify the problem by further tracing.

I am also wondering when Batik's implementation of ...codec/JPEG will be available.

 

   The thing that confuse me the most is that batik-squiggle can opens this SVG file fine.

 

Thanks,

Scott Lo

 

 

A.)

 

package com.arinc.afd.cupps.devices.pr;

 

import java.awt.Color;

import java.io.*;

 

import org.apache.batik.transcoder.Transcoder;

import org.apache.batik.transcoder.image.PNGTranscoder;

import org.apache.batik.transcoder.TranscoderInput;

import org.apache.batik.transcoder.TranscoderOutput;

import org.apache.xmlbeans.impl.xb.xsdschema.FieldDocument.Field.Xpath;

 

import com.sun.org.apache.xerces.internal.impl.dv.util.Base64;

 

public class SvgToPNGTranscode {  

    

    @SuppressWarnings("deprecation")

                public SvgToPNGTranscode(String[] a1) throws Exception {

        // create a JPEG transcoder

        PNGTranscoder t = new PNGTranscoder();

        

        t.addTranscodingHint(PNGTranscoder.KEY_BACKGROUND_COLOR, Color.white);

        t.addTranscodingHint(PNGTranscoder.KEY_PIXEL_TO_MM, new Float(0.10584f));

       

        String[] ar = a1[0].split("\\\\");    

        String[] ar2 = ar[ar.length-1].split("\\.");

  

        // create the transcoder input

        String svgURI = new File(a1[0]).toURL().toString();       

 

        TranscoderInput input = new TranscoderInput(svgURI);

        // create the transcoder output

        OutputStream ostream =  new FileOutputStream(ar2[0] +".PNG");

        TranscoderOutput output = new TranscoderOutput(ostream);

        // save the image

        t.transcode(input, output);

   

        // flush and close the stream then exit

        ostream.flush();

        ostream.close();

   

        System.exit(0);

    }

   

    public static void main(String [] args) throws Exception {

               

                     new SvgToPNGTranscode(args);

  }

}

 

 

 

B.)

 

  

   Inside SVG file, there is a <image.... xlink:href="data:image/jpg;base64,/9j/4AAQ...."/> Line.

 

 

 

 

C.)

 

 

org.apache.batik.bridge.BridgeException: file:/C:/CA2/RobTest2.svg:0

The URI "data:image/jpg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0a..HBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIy..MjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAAqAPUDASIA..AhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQA..AAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3..ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWm..p6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEA..AwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSEx..BhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElK..U1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3..uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwDb+LPx..Z17wH4qtdL0u002aCWyS4ZrqN2YMXdcDa6jGEHb1o8G/FnXvEWnWlxd2mmo816bdhDG4AX7RYRZG..XPO27kP1C+hB4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qH91GAeG+U8tgV7RRQB88XOpeJPE3he58OS/D3VdNmSK9kstSa3kZrWMl5RbRjyl2qyK..tvgMAVIGCPlrT8K+GtSm+HmqPq2iXb6tD4Xa1s2u7VjOjeZfr5ce4bgdjRDaP4Sg6EV7pRQB4Hpn..hbXviH4Mt/D2sWupaGReteG4vLZ5MNFbwRH5W2czSTTSk5+8JPvElh0Hw+u5r7xJd3978OJNHnmv..Yktria1KtaQ/Y2TCMYlIQG3C4GB+/A/3vXKKAPjzwX4L8VWvjrw9cXHhrWYYItTtnkkksJVVFEqk..kkrgADnNe3tpOpf2P4BT+z7vfa6ZaJcL5LZhZbvTWIfj5SFjkJB7Ix7GvVKKAMPwnBNbaPcJPFJE..51O/cK6lSVa7mZTz2KkEHuCDRW5RQB//2Q==.."

on element <image> can't be opened because:

JPEG URL is corrupt or unsupported variant

                at org.apache.batik.bridge.UserAgentAdapter.getBrokenLinkDocument(UserAgentAdapter.java:449)

                at org.apache.batik.bridge.SVGImageElementBridge.createRasterImageNode(SVGImageElementBridge.java:604)

                at org.apache.batik.bridge.SVGImageElementBridge.createImageGraphicsNode(SVGImageElementBridge.java:327)

                at org.apache.batik.bridge.SVGImageElementBridge.buildImageGraphicsNode(SVGImageElementBridge.java:177)

                at org.apache.batik.bridge.SVGImageElementBridge.createGraphicsNode(SVGImageElementBridge.java:119)

                at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:213)

                at org.apache.batik.bridge.GVTBuilder.buildComposite(GVTBuilder.java:171)

                at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:219)

                at org.apache.batik.bridge.GVTBuilder.buildComposite(GVTBuilder.java:171)

                at org.apache.batik.bridge.GVTBuilder.build(GVTBuilder.java:82)

                at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(SVGAbstractTranscoder.java:208)

                at org.apache.batik.transcoder.image.ImageTranscoder.transcode(ImageTranscoder.java:92)

                at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(XMLAbstractTranscoder.java:142)

                at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(SVGAbstractTranscoder.java:156)

                at com.arinc.afd.cupps.devices.pr.SvgToPNGTranscode.<init>(SvgToPNGTranscode.java:35)

                at com.arinc.afd.cupps.devices.pr.SvgToPNGTranscode.main(SvgToPNGTranscode.java:46)

Exception in thread "main" org.apache.batik.transcoder.TranscoderException: null

Enclosed Exception:

file:/C:/CA2/RobTest2.svg:0

The URI "data:image/jpg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0a..HBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIy..MjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAAqAPUDASIA..AhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQA..AAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3..ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWm..p6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEA..AwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSEx..BhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElK..U1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3..uLm6wsPExcbHyMnK0tPU1dbX2N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3k2WVuUvY45oeMLHCZUkXaQBhcFcg19D0UAeD+I/DviTxl4rnudPi1X..wvb+HZYNL05beGTZLHJO0UlxCRsCKI9pIXI2qAWA5rQXRrzVfEWuQReGZ9I0C0u7GyXS0tSLXUP+..JgjSXQTaqH91GAeG+U8tgV7RRQB88XOpeJPE3he58OS/D3VdNmSK9kstSa3kZrWMl5RbRjyl2qyK..tvgMAVIGCPlrT8K+GtSm+HmqPq2iXb6tD4Xa1s2u7VjOjeZfr5ce4bgdjRDaP4Sg6EV7pRQB4Hpn..hbXviH4Mt/D2sWupaGReteG4vLZ5MNFbwRH5W2czSTTSk5+8JPvElh0Hw+u5r7xJd3978OJNHnmv..Yktria1KtaQ/Y2TCMYlIQG3C4GB+/A/3vXKKAPjzwX4L8VWvjrw9cXHhrWYYItTtnkkksJVVFEqk..kkrgADnNe3tpOpf2P4BT+z7vfa6ZaJcL5LZhZbvTWIfj5SFjkJB7Ix7GvVKKAMPwnBNbaPcJPFJE..51O/cK6lSVa7mZTz2KkEHuCDRW5RQB//2Q==.."

on element <image> can't be opened because:

JPEG URL is corrupt or unsupported variant

                at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(SVGAbstractTranscoder.java:227)

                at org.apache.batik.transcoder.image.ImageTranscoder.transcode(ImageTranscoder.java:92)

                at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(XMLAbstractTranscoder.java:142)

                at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(SVGAbstractTranscoder.java:156)

                at com.arinc.afd.cupps.devices.pr.SvgToPNGTranscode.<init>(SvgToPNGTranscode.java:35)

                at com.arinc.afd.cupps.devices.pr.SvgToPNGTranscode.main(SvgToPNGTranscode.java:46)

Corrupt JPEG data: 26 extraneous bytes before marker 0x32

 

 

 

 

D.)

 

 

public Filter handleStream(InputStream inIS,

                               ParsedURL   origURL,

                               boolean     needRawData) {

        final DeferRable  dr  = new DeferRable();

        final InputStream is  = inIS;

        final String      errCode;

        final Object []   errParam;

        if (origURL != null) {

            errCode  = ERR_URL_FORMAT_UNREADABLE;

            errParam = new Object[] {"JPEG", origURL};

        } else {

            errCode  = ERR_STREAM_FORMAT_UNREADABLE;

            errParam = new Object[] {"JPEG"};

        }

 

        Thread t = new Thread() {

                public void run() {

                    Filter filt;

                    try{

                        JPEGImageDecoder decoder;

                        decoder = JPEGCodec.createJPEGDecoder(is);

                        BufferedImage image;

                        try {

     ----------------------> image   = decoder.decodeAsBufferedImage(); <------------------------------------

                        } catch (TruncatedFileException tfe) {

                            image = tfe.getBufferedImage();

                            // Should probably draw some indication

                            // that this is a partial image....

                            if (image == null)

                                throw new IOException

                                    ("JPEG File was truncated");

                        }

                        dr.setBounds(new Rectangle2D.Double

                                     (0, 0, image.getWidth(),

                                      image.getHeight()));

                        CachableRed cr;

                        cr = GraphicsUtil.wrap(image);

                        cr = new Any2sRGBRed(cr);

                        cr = new FormatRed(cr, GraphicsUtil.sRGB_Unpre);

                        WritableRaster wr = (WritableRaster)cr.getData();

                        ColorModel cm = cr.getColorModel();

                        image = new BufferedImage

                            (cm, wr, cm.isAlphaPremultiplied(), null);

                        cr = GraphicsUtil.wrap(image);

                        filt = new RedRable(cr);

                    } catch (IOException ioe) {

                        // Something bad happened here...

                        filt = ImageTagRegistry.getBrokenLinkImage

                            (JPEGRegistryEntry.this, errCode, errParam);

                    } catch (ThreadDeath td) {

                        filt = ImageTagRegistry.getBrokenLinkImage

                            (JPEGRegistryEntry.this, errCode, errParam);

                        dr.setSource(filt);

                        throw td;

                    } catch (Throwable t) {

                        filt = ImageTagRegistry.getBrokenLinkImage

                            (JPEGRegistryEntry.this, errCode, errParam);

                    }

 

                    dr.setSource(filt);

                }

            };

        t.start();

        return dr;

    }

}