package com.rubekid.springmvc.utils;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream; import org.apache.batik.transcoder.TranscoderException;
import org.apache.batik.transcoder.TranscoderInput;
import org.apache.batik.transcoder.TranscoderOutput;
import org.apache.batik.transcoder.image.PNGTranscoder; /**
* svg工具
* @author rubekid
*
*/
public class SvgUtils { public static byte[] toPng(byte[] svgByteArray) throws TranscoderException, IOException{
return toPng(new ByteArrayInputStream(svgByteArray));
} public static byte[] toPng(InputStream inputStream) throws TranscoderException, IOException{
PNGTranscoder transcoder = new PNGTranscoder();
TranscoderInput input = new TranscoderInput(inputStream);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
TranscoderOutput output = new TranscoderOutput(outputStream);
transcoder.transcode(input, output);
outputStream.close();
return outputStream.toByteArray();
}
}
       <dependency>
<groupId>batik</groupId>
<artifactId>batik-transcoder</artifactId>
<version>1.6-1</version>
</dependency>

svg转换工具的更多相关文章

  1. 推荐一个web字体转换工具TTF转SVG

    推荐一个web字体转换工具:https://www.fontsquirrel.com/tools/webfont-generator

  2. web字体格式及几种在线格式转换工具介绍

    原文地址:http://blog.csdn.net/xiaolongtotop/article/details/8316554 目前,文字信息仍是网站最主要的内容,随着CSS3技术的不断成熟,Web字 ...

  3. Unicode编码解码在线转换工具

    // Unicode编码解码在线转换工具 Unicode 是基于通用字符集(Universal Character Set)的标准来发展,并且同时也以书本的形式(The Unicode Standar ...

  4. android px,dp,sp大小转换工具

    package com.voole.playerlib.util; import android.content.Context; /** * Android大小单位转换工具类<br/> ...

  5. Json与javaBean之间的转换工具类

    /**  * Json与javaBean之间的转换工具类  *  * {@code 现使用json-lib组件实现  *    需要  *     json-lib-2.4-jdk15.jar  * ...

  6. Rsa加解密Java、C#、php通用代码 密钥转换工具

    之前发了一篇"TripleDes的加解密Java.C#.php通用代码",后面又有项目用到了Rsa加解密,还是在不同系统之间进行交互,Rsa在不同语言的密钥格式不一样,所以过程中主 ...

  7. ubuntu下编码转换工具

    ubuntu打开windows下的txt或者代码文件,经常会出现乱码, ubuntu自带一种转换工具,是命令行的,下面提供一种最简单的方法进行转换 比如要转换的文件为1.txt,进入1.txt的目录 ...

  8. 日期转换工具类 CommUtil.java

    package com.util; import java.text.ParseException; import java.text.SimpleDateFormat; import java.ut ...

  9. 视频转换工具 Transmageddon

    点这里 Transmageddon 是一个采用 Python 语言开发的视频转换工具,支持输出几乎所有的视频格式,同时也可以生成指定平台下的视频格式. 软件界面如下图所示

随机推荐

  1. Fedora 19+ 启动顺序调整

    首先找到Windows 8的menuentry cat /boot/grub2/grub.cfg | grep Windows 设置Windows 作为默认的启动项 grub2-set-default ...

  2. 不通用版(从SVN取版本,通过MAVEN生成JAVA包,通过SALTSTACK传送到远程服务器并自动重启TOMCAT服务)PYTHON代码

    从昨晚写到今天啊, 第一版测试成功了. PHP和JAVA的更新相对来说,PHP的自动化更新是简单多啦~~ 当然,这只是运维工作当中的一环~~ #!/usr/bin/env python # -*- c ...

  3. Markdown和reStructuredText语法比较

    reStructuredText在线编辑器 http://rst.ninjs.org/ ReST是Docutils的标记语法,Docutils是Python世界的文档工具集.也因为这样ReST在Pyt ...

  4. Go语言开发环境安装

    Go是Google开发的一种编译型,並發型,并具有垃圾回收功能的编程语言. 去http://golang.org/doc/install#download 下载相应的版本. 1.安装go语言:2.将g ...

  5. bzoj3028食物

    http://www.lydsy.com/JudgeOnline/problem.php?id=3028 好吧,这是我第一道生成函数的题目. 先搞出各种食物的生成函数: 汉堡:$1+x^2+x^4+. ...

  6. 声明 && 温馨提示 by ljh2000

    听说有人很喜欢狙我......看我不把你们抓起来嘿嘿嘿! 为了采取措施,不让被狙成为生活常态(雾   ,我要闭关锁国辣,我要开始屯田辣! 以后写完题目先存一波草稿,等屯题屯到10-20道时再一起发出来 ...

  7. Visual Studio创建跨平台移动应用_02.Cordova Extension

    1简介 本章节是关于Visual Studio Tools for Apache Cordova的,目前此产品只发布了预览版.Visual Studio for Apache Cordova帮助熟悉V ...

  8. [Java] 垃圾回收 ( Garbage Collection ) 的步骤演示

    关于 JVM 垃圾回收机制的基础内容,可参考上一篇博客 垃圾回收机制 ( Garbage Collection ) 简介 上一篇博客,介绍了堆的内存被分为三个部分:年轻代.老年代.永生代.这篇博文将演 ...

  9. IMPLEMENTED IN PYTHON +1 | CART生成树

    Introduction: 分类与回归树(classification and regression tree, CART)模型由Breiman等人在1984年提出,CART同样由特征选择.树的生成及 ...

  10. Linux 上使用 Gmail SMTP 服务器发送邮件通知

    导读 假定你想配置一个 Linux 应用,用于从你的服务器或桌面客户端发送邮件信息.邮件信息可能是邮件简报.状态更新(如 Cachet).监控警报(如 Monit).磁盘时间(如 RAID mdadm ...