画像ツール
SVG → PNG変換
SVGファイルをPNG画像に変換。幅・高さ・背景色を設定して高解像度PNGを即ダウンロード。
{ this.svgCode = ev.target.result; };
r.readAsText(f);
},
async convert() {
if(!this.svgCode.trim()) return;
const s = parseFloat(this.scale)||1;
const w = this.width * s, h = this.height * s;
const blob = new Blob([this.svgCode], {type:'image/svg+xml'});
const url = URL.createObjectURL(blob);
const img = new Image();
img.onload = () => {
const canvas = document.createElement('canvas');
canvas.width = w; canvas.height = h;
const ctx = canvas.getContext('2d');
if(!this.transparent) { ctx.fillStyle = this.bgColor; ctx.fillRect(0,0,w,h); }
ctx.drawImage(img, 0, 0, w, h);
URL.revokeObjectURL(url);
this.preview = canvas.toDataURL('image/png');
};
img.src = url;
},
download() {
if(!this.preview) return;
const a = document.createElement('a');
a.href = this.preview; a.download = this.filename; a.click();
}
}">
SVG Input
Detected size:
→ 出力:
Preview & Download
SVGをアップロードまたは貼り付けて変換ボタンを押してください。