Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

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.

Posted
Updated 19-Nov-09 7:11am
v2

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 )

 
Share this answer
 

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.

Render SVG: http://www.codeplex.com/svg

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

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.

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900