简体   繁体   English

将SVG转换为图像(png,jpg)

[英]Convert SVG to an image (png, jpg)

Hey i'm encountering the following problem. 嘿,我遇到以下问题。 I want to convert an dinamically generated (through php) SVG image to an image so a user can rightclick and "save image .." 我想将通过语法生成的(通过php)SVG图像转换为图像,以便用户可以右键单击并“保存图像..”

at the moment the image is displayed as an svg for example like this: 目前,图像显示为svg,例如:

<embed id="image_wuerfel" classid="image/svg+xml" 
src="/svg/models.php?s=c&w=5&h=5&l=5&m=1&desc=1&wh=250&wl=250" 
type="image/svg+xml" width="250" height="250">
</embed>

it sends a GET - Request to the models.php, where the SVG image is generated and will be returned. 它将GET-请求发送到models.php,在其中生成SVG图像并将其返回。

Is there something like a JS library or something, that converts this into an image file? 是否有像JS库之类的东西将其转换为图像文件?

您可以使用ImageMagick的Imagick php类。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM