473,396 Members | 1,712 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Save SVG as JPG?

I have a C#/Xslt utility creating a relatively large SVG diagram from a
bunch of Xml sources I have.

This is cool for those who have SVG plugins installed, but I also want to
support downlevel browsers with a JPG equivalent of the SVG output.
Anyone know of any way I can make this conversion in a line of code or two?
Something like :

....
System.Xml.XmlTextWriter wtr = new System.Xml.XmlTextWriter("output.svg",
System.Text.Encoding.UTF8);
trans.Load(xpdocxslt);
trans.Transform(xpdoc, xslArg, svgdoc);

svgdoc.SaveAs("myimage", ImageFormats.JPEG);

thanks,
Steven
http://stevenlivingstone.com
Nov 12 '05 #1
2 6584
There is nothing built into the .NET framework. You may want to ask DonXML
[0] if he has anything. Otherwise you could wrap Apache's Batik library with
a web service interface ... although that's hardly efficient ;)

--
HTH
Christoph Schittko [MVP, XmlInsider]
Software Architect, .NET Mentor

[0] http://weblogs.asp.net/donxml

"Steven Livingstone" <s.***********@nospam.btinternet.com> wrote in message
news:e$**************@TK2MSFTNGP09.phx.gbl...
I have a C#/Xslt utility creating a relatively large SVG diagram from a
bunch of Xml sources I have.

This is cool for those who have SVG plugins installed, but I also want to
support downlevel browsers with a JPG equivalent of the SVG output.
Anyone know of any way I can make this conversion in a line of code or two? Something like :

...
System.Xml.XmlTextWriter wtr = new System.Xml.XmlTextWriter("output.svg",
System.Text.Encoding.UTF8);
trans.Load(xpdocxslt);
trans.Transform(xpdoc, xslArg, svgdoc);

svgdoc.SaveAs("myimage", ImageFormats.JPEG);

thanks,
Steven
http://stevenlivingstone.com

Nov 12 '05 #2
Thanks Christoph, was a shot in the dark really.

I'll try DonXml and maybe even the .net weblogs and see if i get any
response.

cheers,
Steven.

"Christoph Schittko [MVP]" <ch********************@austin.rr.com> wrote in
message news:u3**************@TK2MSFTNGP12.phx.gbl...
There is nothing built into the .NET framework. You may want to ask DonXML
[0] if he has anything. Otherwise you could wrap Apache's Batik library with a web service interface ... although that's hardly efficient ;)

--
HTH
Christoph Schittko [MVP, XmlInsider]
Software Architect, .NET Mentor

[0] http://weblogs.asp.net/donxml

"Steven Livingstone" <s.***********@nospam.btinternet.com> wrote in message news:e$**************@TK2MSFTNGP09.phx.gbl...
I have a C#/Xslt utility creating a relatively large SVG diagram from a
bunch of Xml sources I have.

This is cool for those who have SVG plugins installed, but I also want to support downlevel browsers with a JPG equivalent of the SVG output.
Anyone know of any way I can make this conversion in a line of code or

two?
Something like :

...
System.Xml.XmlTextWriter wtr = new System.Xml.XmlTextWriter("output.svg", System.Text.Encoding.UTF8);
trans.Load(xpdocxslt);
trans.Transform(xpdoc, xslArg, svgdoc);

svgdoc.SaveAs("myimage", ImageFormats.JPEG);

thanks,
Steven
http://stevenlivingstone.com


Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: F. Hall | last post by:
If I read a bitmap image from one file and save it to another the save operation is slow unless I draw on the image. In other words, Image inputImage = Image.FromFile( @"c:\temp\source.bmp" );...
4
by: WJA | last post by:
I'm probably missing something here but I can't understand the following. When 2 users try to save a record with the same primary key (a number field), the first record saves as expected, but the...
5
by: kevin | last post by:
Hi, Any help with this would be really appreciated! I'm trying to download a file from a remote server. The access permissions is okay but the problem I'm facing is that the file is getting...
2
by: Alvo von Cossel I | last post by:
hi, you can create a file with the savefiledialog. once you have done that and edit the file in the text editior that i wrote you cannot save the file, you can only create a new file or replace...
10
by: GJP | last post by:
Hello. Ive been asked to make my own notepade for college assignment. All ig going well, but i cant get the save to work. I can get Save a (shows dialog box), i can get it to just save too,...
5
by: C Watson | last post by:
Hi, I'm wondering if anyone can help me with AJAX in ASP.NET 1.1. I have a very specific feature that I would like to use it for. I have a rather long form that the users use to enter data...
3
by: =?Utf-8?B?YXNkZg==?= | last post by:
Hello. I am making a web application with c# and am using this code: Response.ContentType = "application/x-excel"; Response.AddHeader("Content-Disposition", "attachment;filename=" +...
0
by: amrhi | last post by:
Hy Guys , Can anybody help me ? I try to make small web database in my unit. Some of fields have on change behaviour to get other data that automatically filled other text field. But when i try to...
12
by: =?Utf-8?B?RnJlZU5FYXN5?= | last post by:
Hello, the scenario: There's an ASPX page which shows some text and has three buttons at the bottom: Save, Print and Close. Print and close is done by javascript. But how can I save the page...
0
by: ppardi | last post by:
I'm developing an addin for Word 2007 and I need to determine whether a user saves a Word 2007 document in an older format (97-2003) after a save as is done. The scenario is that the user starts...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.