Package org.apache.batik.transcoder

Examples of org.apache.batik.transcoder.TranscoderOutput


        ByteArrayOutputStream output = new ByteArrayOutputStream();

        JPEGTranscoder transcoder = new JPEGTranscoder();
        transcoder.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, new Float(
                Math.max(0, Math.min(quality, 100)) / 100.0f));
        transcoder.writeImage(thumb, new TranscoderOutput(output));

        DataSource dataSource= new ByteArrayDataSource(output.toByteArray(), "application/octet-stream");
        return new DataHandler(dataSource);
    }
View Full Code Here


//        TranscoderInput transcoderInput = new TranscoderInput(svgDoc);
        Reader stringReader = new StringReader(inputString);
        TranscoderInput transcoderInput2 = new TranscoderInput(stringReader);
        // Create the transcoder output.
        OutputStream osByteArray = new ByteArrayOutputStream();
        TranscoderOutput transcoderOutput = new TranscoderOutput(osByteArray);
        try {
            jpegTranscoder.transcode(transcoderInput2, transcoderOutput);
        } catch (TranscoderException e) {
            log.error("JPEGTranscoder error", e);
            return null;
View Full Code Here

//        TranscoderInput transcoderInput = new TranscoderInput(svgDoc);
        Reader stringReader = new StringReader(inputString);
        TranscoderInput transcoderInput2 = new TranscoderInput(stringReader);
        // Create the transcoder output.
        OutputStream osByteArray = new ByteArrayOutputStream();
        TranscoderOutput transcoderOutput = new TranscoderOutput(osByteArray);
        try {
            jpegTranscoder.transcode(transcoderInput2, transcoderOutput);
        } catch (TranscoderException e) {
            log.error("JPEGTranscoder transcode error", e);
            return null;
View Full Code Here

       
        try {
            TranscoderInput transInput = new TranscoderInput(doc);

            // Buffering is done by the pipeline (See shouldSetContentLength)
            TranscoderOutput transOutput = new TranscoderOutput(this.output);
            transcoder.transcode(transInput, transOutput);
        } catch (TranscoderException ex) {
            if (ex.getException() != null) {
                if (getLogger().isDebugEnabled()) {
                    getLogger().debug("Got transcoder exception writing image, rethrowing nested exception", ex);
View Full Code Here

            InputStream is = new java.io.FileInputStream(params[0]);
            Document doc = createSVGDocument(is);
            SVGTranscoder svgT = new SVGTranscoder();
            TranscoderInput input = new TranscoderInput(doc);
            Writer ostream = new java.io.FileWriter(params[1]);
            TranscoderOutput output = new TranscoderOutput(ostream);
            svgT.transcode(input, output);
            ostream.flush();
            ostream.close();

        } catch (Exception e) {
View Full Code Here

    public void notify(Document doc) throws SAXException {
        try {
            TranscoderInput transInput = new TranscoderInput(doc);

            // Buffering is done by the pipeline (See shouldSetContentLength)
            TranscoderOutput transOutput = new TranscoderOutput(this.output);
            transcoder.transcode(transInput, transOutput);
        } catch (TranscoderException ex) {
            if (ex.getException() != null) {
                if (getLogger().isDebugEnabled()) {
                    getLogger().debug("Got transcoder exception writing image, rethrowing nested exception", ex);
View Full Code Here

    public static void svgToJPEG(File svg, File jpeg) throws IOException, TranscoderException {
        // Create the transcoder input.
        TranscoderInput input = new TranscoderInput(svg.toURI().toString());
        // Create the transcoder output.
        OutputStream ostream = new FileOutputStream(jpeg);
        TranscoderOutput output = new TranscoderOutput(ostream);

        // Create a JPEG transcoder
        Transcoder t = new JPEGTranscoder();

        // Set the transcoding hints.
View Full Code Here

    public static void svgToJPEG(Document svg, File jpeg) throws IOException, TranscoderException {
        // Create the transcoder input.
        TranscoderInput input = new TranscoderInput(svg);
        // Create the transcoder output.
        OutputStream ostream = new FileOutputStream(jpeg);
        TranscoderOutput output = new TranscoderOutput(ostream);

        // Create a JPEG transcoder
        Transcoder t = new JPEGTranscoder();

        // Set the transcoding hints.
View Full Code Here

    public static void svgToJPEG(InputStream svg, OutputStream jpeg) throws IOException, TranscoderException {
        // Create the transcoder input.
        TranscoderInput input = new TranscoderInput(svg);

        TranscoderOutput output = new TranscoderOutput(jpeg);

        // Create a JPEG transcoder
        Transcoder t = new JPEGTranscoder();

        // Set the transcoding hints.
View Full Code Here

    public static void svgToPNG(InputStream svg, OutputStream png) throws IOException, TranscoderException {
        // Create the transcoder input.
        TranscoderInput input = new TranscoderInput(svg);

        TranscoderOutput output = new TranscoderOutput(png);

        // Create a JPEG transcoder
        Transcoder t = new PNGTranscoder();

        // Save the image.
View Full Code Here

TOP

Related Classes of org.apache.batik.transcoder.TranscoderOutput

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.