473,236 Members | 1,403 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,236 software developers and data experts.

SVG to raster conversion.

Does anybody know a good solution (preferably in python) for rasterizing
SVG or other vector graphics.

I'm thinking something like

vector_image = SVGFile(path_to_image)
raster_image = vector_image.rasterize(format, (width, height), dpi)
raster_image.write(out_file)

Thanks for any pointers you might have.
Sep 16 '07 #1
3 3437
J. Cliff Dyer wrote:
Does anybody know a good solution (preferably in python) for rasterizing
SVG or other vector graphics.

I'm thinking something like

vector_image = SVGFile(path_to_image)
raster_image = vector_image.rasterize(format, (width, height), dpi)
raster_image.write(out_file)

Thanks for any pointers you might have.
The GIMP can do it, and you can even program it in Python.

Stefan
Sep 16 '07 #2
Stefan Behnel wrote:
J. Cliff Dyer wrote:
>Does anybody know a good solution (preferably in python) for rasterizing
SVG or other vector graphics.

I'm thinking something like

vector_image = SVGFile(path_to_image)
raster_image = vector_image.rasterize(format, (width, height), dpi)
raster_image.write(out_file)

Thanks for any pointers you might have.

The GIMP can do it, and you can even program it in Python.

Stefan
Thanks. I can't find a gimp-python package for gimp-2.x anywhere
though. Do
es such a thing exist?
Sep 16 '07 #3
J. Cliff Dyer a écrit :
Does anybody know a good solution (preferably in python) for rasterizing
SVG or other vector graphics.

I'm thinking something like

vector_image = SVGFile(path_to_image)
raster_image = vector_image.rasterize(format, (width, height), dpi)
raster_image.write(out_file)

Thanks for any pointers you might have.
Another link to complement other replies:

Maybe witgh Cairo:

Library:
http://cairographics.org/

SVG support:
http://cairographics.org/manual/cairo-SVG-Surfaces.html

Python binding:
http://cairographics.org/bindings/
A+

Laurent.
Sep 17 '07 #4

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

Similar topics

3
by: R.Marquez | last post by:
Does any one know of a way to convert PDF documents into a raster format, such as TIFF or JPEG? Of course to do it in Python would be my preference, but if you know of another way to do this...
1
by: Stub | last post by:
Docs says that "The compiler does not use an explicit constructor to implement an implied conversion of types. It's purpose is reserved explicitly for construction." I put up code of three cases...
2
by: John Palmer | last post by:
Hi all, This may be a stupid question here, but I need to be able to convert a SVG document into any kind of raster format (PNG, JPG, BMP, GIF, whatever). The catch is that, tho I have a good...
1
by: paul | last post by:
library for querying virtual polygon over raster spatial data in my c++ application, after calculating my polygon i wish to define it (simple 4 sided polygon with floats or line parameters) and...
1
by: John Tempest | last post by:
Please help. I got no response to my previous query "?Using raster fonts as graphics in dotNet?" posted on 7th July. The principal question remains: How can I (if I can at all) select a raster...
11
by: Steve Gough | last post by:
Could anyone please help me to understand what is happening here? The commented line produces an error, which is what I expected given that there is no conversion defined from type double to type...
4
by: Nick K. | last post by:
Is there any native ,Net assemblies or open C# source code that can perform vector to raster conversion?
2
by: Alex Sedow | last post by:
Why explicit conversion from SomeType* to IntPtr is not ambiguous (according to standart)? Example: // System.IntPtr class IntPtr { public static explicit System.IntPtr (int); public...
7
by: dave | last post by:
Hi All. I've been formulating in my head a simple image editor. I actually started prototyping is some time ago in Java, but am liking Python more and more. My editor will be nowhere near the level...
4
by: alarock | last post by:
hi, I have performed some drawing using Vector image,DrawRectangle etc... and then i converted to raster Image(bitmap) i found in the zoomed raster image(bitmap) the outer...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...

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.