svg to png

version: 3 1 4 official


描述

该函数自动识别输入图片格式,利用 Canvas 渲染将 SVG 转换为 PNG,或将 PNG 图片嵌入 SVG 结构中,并提供转换后的预览与下载功能。

This function automatically detects the input format to convert SVG to PNG using Canvas rendering, or embeds a PNG into an SVG structure, providing a preview and download option for the converted image.


关于
SVG PNG
中文

📄 功能介绍

SVG 与 PNG 图片格式互转工具,能够自动识别输入的图片格式,并将其转换为另一种格式。支持双向转换,操作简单快捷。

✨ 主要特性

  • 自动格式识别
  • 双向格式转换
  • 高清输出(2倍分辨率)
  • 一键下载结果
  • 纯浏览器端处理
  • 无需上传服务器

📥 支持的输入格式

  • SVG:SVG 源代码、SVG Data URL、.svg 文件
  • PNG:PNG Data URL、.png 图片文件、在线图片链接

🔄 转换说明

  • SVG → PNG:将矢量图形栅格化为高清 PNG 位图,支持 2 倍分辨率输出
  • PNG → SVG:将 PNG 图片嵌入到 SVG 容器中,保持原始图像质量
⚠️ 注意:PNG 转 SVG 是将位图嵌入 SVG 容器,并非真正的矢量化转换。如需将位图转换为真正的矢量图形,需要使用专业的图像描摹工具。

💡 使用场景

  • 将 SVG 图标转换为 PNG 用于不支持 SVG 的平台
  • 将设计稿中的 SVG 导出为 PNG 图片
  • 将 PNG 图片封装为 SVG 格式以便统一管理
  • 网页开发中的图片格式适配
English

📄 Introduction

A bidirectional SVG and PNG image format converter that automatically detects the input format and converts it to the other format. Simple, fast, and runs entirely in your browser.

✨ Key Features

  • Auto format detection
  • Bidirectional conversion
  • HD output (2x resolution)
  • One-click download
  • Client-side processing
  • No server upload needed

📥 Supported Input Formats

  • SVG: SVG source code, SVG Data URL, .svg files
  • PNG: PNG Data URL, .png image files, online image URLs

🔄 Conversion Details

  • SVG → PNG: Rasterizes vector graphics into high-definition PNG bitmap with 2x resolution support
  • PNG → SVG: Embeds PNG image into an SVG container while preserving original image quality
⚠️ Note: PNG to SVG conversion embeds the bitmap into an SVG container; it does not vectorize the image. For true vectorization, professional image tracing tools are required.

💡 Use Cases

  • Convert SVG icons to PNG for platforms that don't support SVG
  • Export SVG designs as PNG images
  • Wrap PNG images in SVG format for unified asset management
  • Image format adaptation in web development