xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Philip Mackie <Philip.Mac...@RCP.co.uk>
Subject GIF Transcoder problems ...
Date Tue, 14 Jan 2003 10:31:08 GMT
Hello all. 

I have a program that tries to convert SVG to GIF. I'm using the Acme
packages to encode the GIF, and Thierry Kormann's GIF Transcoder. The
program works for some svg files and not for others. I've tried to narrow
down the problem, but have had some very confusing results! I get the same
type of (very helpful) error message:

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

    Enclosed Exception:
    108
            at
org.apache.batik.transcoder.image.ImageTranscoder.transcode(Unknown Source)
            at
org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(Unknown Source)
            at ConvertSVGtoGIF.main(ConvertSVGtoGIF.java:35)

The error number (in this case 108) seems to change.

Basically, I have an SVG file that draws a simple map, and referneces a very
simple style sheet for drawing info as usual. I've managed to isolate a file
so that the change of a class name, a few points or a change rgb value on
the stylesheet breaks the program. First the SVG file:

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
    "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
    <?xml-stylesheet href="style1.css" type="text/css"?>

    <svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" width="1000" height="1000"
viewBox="0 0 1000 1000">
        <defs>
            <path id="castle" class="castle"
                d="M 0 0 L 0 10 L 10 10 L 10 0 L 8 0 L 8 4 L 6 4 L 6 0 L 4 0
L 4 4 L 2 4 L 2 0 z" />
            <path id="zoo" class="zoo"
                d="M 0 0 L 5 0 L 0 7 L 5 7" />    
        </defs>
       <g id="TOWNS">        
           <polygon id="Didcot" class="town" 
               points="515,481 528,484 540,490 543,500 538,508 517,510
510,508 515,481 515,481"/>
            ..
        more towns
        ..
           <polygon id="Botley" class="town" 
               points="505,337 507,344 462,364 460,347 474,338 486,337
505,337"/>            
        </g><!-- End of Towns -->  

       <g id="ROADS">
          **************************************THE OFFENDING
LINE*************************************
           <polyline id="M40" class="motorway" points="635,357 618,350
635,357"/> 

       </g><!-- End of Roads -->   
    </svg> 

If I change the points or class name for this line (depending on values in
the stylesheet) the SVGtoGIFEncoder sometimes breaks!

The stylesheet: (I'm using web-safe colors)

    polyline.minorA 
    {
        fill: none;
        stroke: rgb(204,0,51);
        stroke-width: 1.5;
    }
    polyline.majorA 
    {
        fill: none;
        stroke: rgb(51,204,51);
        stroke-width: 2;
    }
    polyline.motorway 
    {
        fill: none;
        stroke: rgb(102,153,255);
        stroke-width: 3.0;
    }
    polygon.town 
    {
        fill: rgb(102,102,102);
    }
    path.castle
    {
        fill: black;
    }
    path.zoo
    {
        stroke: black;
        stroke-width: 1;
        fill: none;
    }
    text.city
    {
        fill: black;
    }

Again - changing color values sometimes makes the thing work or not work!

I'd really like to be able to iron out  these problems - it must be a
coloring problem. The only change I made to the GIF Transcoder is too index
the image to limit the number of colors to 256:

    // Index the image so that the number of colors is reduced to 256
    new GifEncoder (IndexImage.getIndexedImage(img), ostream).encode ();

Thanks

Phil


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Mime
View raw message