Package org.apache.batik.transcoder.image

Examples of org.apache.batik.transcoder.image.PNGTranscoder.transcode()


    public static void main(String [] args) throws Exception
  {
        PNGTranscoder  aTranscoder = new PNGTranscoder();
        OutputStream  aOStm = new FileOutputStream( args[ 1 ] );

        aTranscoder.transcode( new TranscoderInput( new File( args[ 0 ] ).toURL().toString() ), new TranscoderOutput( aOStm ) );

        aOStm.flush();
        aOStm.close();
    }
}
View Full Code Here


    // create the transcoder output
    TranscoderOutput output = new TranscoderOutput(outputStream);
   
    // save the image
    try {
      t.transcode(input, output);
    } catch (TranscoderException e) {
      logger.error("Impossible to convert svg to jpeg: " + e.getCause(), e);
      throw new SpagoBIEngineRuntimeException("Impossible to convert svg to jpeg: " + e.getCause(), e);
    }
  }
View Full Code Here

            File tmpPng = File.createTempFile(
                "dispelValidation", ".png");
            tmpPng.deleteOnExit();
            os = new FileOutputStream(tmpPng);
            TranscoderOutput output = new TranscoderOutput(os);
            t.transcode(input, output);
            os.flush();
            os.close();
            ret = ImageDescriptor.createFromURL(tmpPng.toURL());
          }
        } catch (CoreException e1) {
View Full Code Here

                    ByteArrayOutputStream bout = new ByteArrayOutputStream();
                    PNGTranscoder t = new PNGTranscoder();
                    t.addTranscodingHint(ImageTranscoder.KEY_MEDIA, "screen");
                    TranscoderInput input = new TranscoderInput(new StringReader(formattedSvg));
                    TranscoderOutput output = new TranscoderOutput(bout);
                    t.transcode(input, output);
                    resp.setCharacterEncoding("UTF-8");
                    resp.setContentType("text/plain");
                    resp.getWriter().write("<img src=\"data:image/png;base64," + Base64.encodeBase64(bout.toByteArray()) + "\">");
                } else {
                    storeInRepository(uuid, rawSvg, transformto, processid, repository);
View Full Code Here

                    t.addTranscodingHint(ImageTranscoder.KEY_MEDIA, "screen");
                    TranscoderInput input = new TranscoderInput(new StringReader(
                            formattedSvg));
                    TranscoderOutput output = new TranscoderOutput(
                            resp.getOutputStream());
                    t.transcode(input, output);
                }
            } catch (TranscoderException e) {
                resp.sendError(500, e.getMessage());
            }
        } else if (transformto != null && transformto.equals(TO_SVG)) {
View Full Code Here

                    t.addTranscodingHint(ImageTranscoder.KEY_MEDIA, "screen");
                    TranscoderInput input = new TranscoderInput(new StringReader(
                            rawSvg));
                    TranscoderOutput output = new TranscoderOutput(outputStream);
                    try {
                        t.transcode(input, output);
                    } catch (Exception e) {
                        // issue with batik here..do not make a big deal
                        _logger.debug(e.getMessage());
                    }
                } else if(transformto.equals(TO_SVG)) {
View Full Code Here

    // create the transcoder output
    TranscoderOutput output = new TranscoderOutput(outputStream);
   
    // save the image
    try {
      t.transcode(input, output);
    } catch (TranscoderException e) {
      logger.error("Impossible to convert svg to png: " + e.getCause(), e);
      throw new SpagoBIEngineRuntimeException("Impossible to convert svg to png: " + e.getCause(), e);
    }
  }
View Full Code Here

            bos = new ByteArrayOutputStream();
            jaxbContext.createMarshaller().marshal(svg, bos);
            bis = new ByteArrayInputStream(bos.toByteArray());
            TranscoderInput input = new TranscoderInput(bis);
            TranscoderOutput output = new TranscoderOutput(out);
            t.transcode(input, output);
        } finally {
            if (bos != null)
                bos.close();
            bos = null;
            if (bis != null)
View Full Code Here

          TranscoderInput input = new TranscoderInput(svgStream);
          file.createNewFile();
        outputStream = new FileOutputStream(file);
        PNGTranscoder transcoder = new PNGTranscoder();
        TranscoderOutput output = new TranscoderOutput(outputStream);
      transcoder.transcode(input, output);
      outputStream.flush();
     
      }catch(Exception e){
        throw new RuntimeException(e);
      }finally{
View Full Code Here

    public static void main(String [] args) throws Exception
  {
        PNGTranscoder  aTranscoder = new PNGTranscoder();
        OutputStream  aOStm = new FileOutputStream( args[ 1 ] );

        aTranscoder.transcode( new TranscoderInput( new File( args[ 0 ] ).toURL().toString() ), new TranscoderOutput( aOStm ) );

        aOStm.flush();
        aOStm.close();
    }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.