在.NET中使用SVG到JPEG [英] SVG to JPEG in .NET

查看:82
本文介绍了在.NET中使用SVG到JPEG的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都知道如何在C#.NET(或VB)中将矢量图形数据(SVG)转换为JPEG?我希望能够从Flash绘图应用程序请求中获取POSTed矢量数据,并使用JPEG进行回复。

Anyone know how to convert Vector Graphic Data (SVG) to a JPEG in C#.NET (or VB)? I want to be able to take POSTed vector data from a Flash drawing app request, and respond with a JPEG.

推荐答案

我' d想象你最好的选择是拍摄svg的截图并将其粘贴到油漆中。 您还可以在表单中放置一个Web浏览器控件并使用代码进行屏幕截图(在.NET中执行)

I'd imagine your best bet is to take a screenshot of the svg and paste it into paint.  you could also put a web browser control in a form and do a screen shot with code ( to do it in .NET )


我不太喜欢只是为了转换图像而创建一个完整的Web浏览器实例。我建议您找到一个可以将SVG图像渲染为位图数据的库,然后使用.Net的内置图像编码类将该数据转换为JPEG。

I don't much like the idea of creating a whole web browser instance just to convert an image. I'd recommend you find a library that can render SVG images to bitmap data, then convert that data to a JPEG using .Net's built in image encoding classes.

渲染SVG : http://www.codeplex.com/svg

编码JPEG: http://msdn.microsoft.com/en-us/library/aa970689.aspx

我认为该页面显示了如何使用文件流对图像进行编码(即,在对图像进行编码/解码之前,图像必须位于文件系统上)。但是,我很确定内存流存在重载(因此您可以在内存中执行所有操作而无需触及文件系统)。我从未亲身体验过上面发布的SVG渲染库...这是我在进行Google搜索时遇到的第一件事。

I think that page shows how to encode images using file streams (i.e., the image has to be on the file system before you encode/decode it). However, I'm pretty sure there are overloads for memory streams (so you can do everything in memory without ever touching the file system). I've never had personal experience with the SVG rendering library I posted above... was just the first thing I came across when I did a Google search.


这篇关于在.NET中使用SVG到JPEG的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆