相关疑难解决方法(0)

将内联SVG另存为JPEG/PNG/SVG

我的html中有一个内联SVG,我需要能够将其保存为JPEG,PNG或SVG.

我尝试了一些不同的方法,将SVG转换为画布,然后转换为JPEG,但我无法使这些工作.

这是我的内联SVG的一个例子.

.font {
	color: #ffffff;
	font-family: Roboto;
	font-weight: bold;
	text-transform: uppercase;
}
.name {
	font-size: 64pt;
}
.top-bar-text {
	font-size: 32pt;
}
.font tspan {
	dominant-baseline: middle;
}
Run Code Online (Sandbox Code Playgroud)
<link href='http://fonts.googleapis.com/css?family=Roboto:700' rel='stylesheet' type='text/css'>

<svg width="256" height="256" id="icon">
  <rect class="bg1" id="bg_color_1" x="0" y="0" width="256" height="256" fill="#4cbc5a" />
  <path class="bg2" id="bg_color_2" d="M 0 96 L0,256 L256,256 L256,96 s -128 96 -256 0" fill="#08a21c" />
  <text id="left_corner_text" x="24" y="36" width="48" height="64" class="top_bar lct font top-bar-text" text-anchor="middle" fill="#ffffff"><tspan>1</tspan></text>
  <text id="right_corner_text" x="232" y="36" width="48" …
Run Code Online (Sandbox Code Playgroud)

javascript svg png jpeg

30
推荐指数
2
解决办法
3万
查看次数

标签 统计

javascript ×1

jpeg ×1

png ×1

svg ×1