You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Dani <al...@wanadoo.es> on 2003/05/21 12:13:35 UTC

Problem creating a JPEG

Hello. I'm starting with Batik. I have a problem creating a JPEG from a .svg
file. The example works with anne.svg example file and PNGTranscoder, but it
doesn't work with JPEGTranscoder (I can't see the image but  there isn't any
exception)


This is the example code:

public class SaveAsJPEG {

    public static void main(String [] args) {
   try {

        // PNGTranscoder t = new PNGTranscoder();
        JPEGTranscoder t = new JPEGTranscoder();
        // set the transcoding hints
        t.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, new Float(1.0));
        // create the transcoder input
        String svgURI = new File(args[0]).toURL().toString();
        TranscoderInput input = new TranscoderInput(svgURI);
        // create the transcoder output
        OutputStream ostream = new FileOutputStream("out.jpg");
        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);

      }catch(Exception e){
       e.printStackTrace();
      }
    }
}


What's the problem. Thank.


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


RE: Problem creating a JPEG

Posted by Dani <al...@wanadoo.es>.
OK. It was the version. Now it works fine. Thanks a lot


----- Original Message -----
From: Dani <al...@wanadoo.es>
To: Batik Users <ba...@xml.apache.org>
Sent: Wednesday, May 21, 2003 2:18 PM
Subject: RE: Problem creating a JPEG


> I'm using 1.1.1 version. I will upgrade it. The code writes a valid but
> blank JPEG (I think is valid, because i can open it with any picture
> program).
>
>
>
>
> ----- Original Message -----
> From: Thomas E Deweese <th...@kodak.com>
> To: Batik Users <ba...@xml.apache.org>
> Sent: Wednesday, May 21, 2003 1:44 PM
> Subject: RE: Problem creating a JPEG
>
>
> > >>>>> "D" == Dani  <al...@wanadoo.es> writes:
> >
> > D> Hello. I'm starting with Batik. I have a problem creating a JPEG
> > D> from a .svg file. The example works with anne.svg example file and
> > D> PNGTranscoder, but it doesn't work with JPEGTranscoder (I can't see
> > D> the image but there isn't any exception)
> >
> >    What version of Batik?  If it's not 1.5b5 or CVS please upgrade.
> > Also what does 'I can't see the image' mean?  No file is written, an
> > empty file is written, a valid JPEG of a blank image is written?
> >
> > D> This is the example code:
> >
> > D> public class SaveAsJPEG {
> >
> > D>     public static void main(String [] args) { try {
> >
> > D>         // PNGTranscoder t = new PNGTranscoder(); JPEGTranscoder t
> > D> = new JPEGTranscoder(); // set the transcoding hints
> > D> t.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, new Float(1.0));
> > D> // create the transcoder input String svgURI = new
> > D> File(args[0]).toURL().toString(); TranscoderInput input = new
> > D> TranscoderInput(svgURI); // create the transcoder output
> > D> OutputStream ostream = new FileOutputStream("out.jpg");
> > D> TranscoderOutput output = new TranscoderOutput(ostream); // save
> > D> the image t.transcode(input, output); // flush and close the stream
> > D> then exit ostream.flush(); ostream.close(); System.exit(0);
> >
> > D>       }catch(Exception e){ e.printStackTrace(); } } }
> >
> >
> > D> What's the problem. Thank.
> >
> >
> > D> ---------------------------------------------------------------------
> > D> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org For
> > D> additional commands, e-mail: batik-users-help@xml.apache.org
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> > For additional commands, e-mail: batik-users-help@xml.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
>
>


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


RE: Problem creating a JPEG

Posted by Dani <al...@wanadoo.es>.
I'm using 1.1.1 version. I will upgrade it. The code writes a valid but
blank JPEG (I think is valid, because i can open it with any picture
program).




----- Original Message -----
From: Thomas E Deweese <th...@kodak.com>
To: Batik Users <ba...@xml.apache.org>
Sent: Wednesday, May 21, 2003 1:44 PM
Subject: RE: Problem creating a JPEG


> >>>>> "D" == Dani  <al...@wanadoo.es> writes:
>
> D> Hello. I'm starting with Batik. I have a problem creating a JPEG
> D> from a .svg file. The example works with anne.svg example file and
> D> PNGTranscoder, but it doesn't work with JPEGTranscoder (I can't see
> D> the image but there isn't any exception)
>
>    What version of Batik?  If it's not 1.5b5 or CVS please upgrade.
> Also what does 'I can't see the image' mean?  No file is written, an
> empty file is written, a valid JPEG of a blank image is written?
>
> D> This is the example code:
>
> D> public class SaveAsJPEG {
>
> D>     public static void main(String [] args) { try {
>
> D>         // PNGTranscoder t = new PNGTranscoder(); JPEGTranscoder t
> D> = new JPEGTranscoder(); // set the transcoding hints
> D> t.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, new Float(1.0));
> D> // create the transcoder input String svgURI = new
> D> File(args[0]).toURL().toString(); TranscoderInput input = new
> D> TranscoderInput(svgURI); // create the transcoder output
> D> OutputStream ostream = new FileOutputStream("out.jpg");
> D> TranscoderOutput output = new TranscoderOutput(ostream); // save
> D> the image t.transcode(input, output); // flush and close the stream
> D> then exit ostream.flush(); ostream.close(); System.exit(0);
>
> D>       }catch(Exception e){ e.printStackTrace(); } } }
>
>
> D> What's the problem. Thank.
>
>
> D> ---------------------------------------------------------------------
> D> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org For
> D> additional commands, e-mail: batik-users-help@xml.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
>
>


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


RE: Problem creating a JPEG

Posted by Thomas E Deweese <th...@kodak.com>.
>>>>> "D" == Dani  <al...@wanadoo.es> writes:

D> Hello. I'm starting with Batik. I have a problem creating a JPEG
D> from a .svg file. The example works with anne.svg example file and
D> PNGTranscoder, but it doesn't work with JPEGTranscoder (I can't see
D> the image but there isn't any exception)

   What version of Batik?  If it's not 1.5b5 or CVS please upgrade.
Also what does 'I can't see the image' mean?  No file is written, an
empty file is written, a valid JPEG of a blank image is written?

D> This is the example code:

D> public class SaveAsJPEG {

D>     public static void main(String [] args) { try {

D>         // PNGTranscoder t = new PNGTranscoder(); JPEGTranscoder t
D> = new JPEGTranscoder(); // set the transcoding hints
D> t.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, new Float(1.0));
D> // create the transcoder input String svgURI = new
D> File(args[0]).toURL().toString(); TranscoderInput input = new
D> TranscoderInput(svgURI); // create the transcoder output
D> OutputStream ostream = new FileOutputStream("out.jpg");
D> TranscoderOutput output = new TranscoderOutput(ostream); // save
D> the image t.transcode(input, output); // flush and close the stream
D> then exit ostream.flush(); ostream.close(); System.exit(0);

D>       }catch(Exception e){ e.printStackTrace(); } } }


D> What's the problem. Thank.


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




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