Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Render Project as SVG #357

Open
clemjvdm opened this issue Dec 17, 2024 · 3 comments
Open

Enhancement: Render Project as SVG #357

clemjvdm opened this issue Dec 17, 2024 · 3 comments

Comments

@clemjvdm
Copy link

Hello, currently I believe a project can only be rendered to a rasterized image. It would be nice to be able to export it as an SVG as well.

@clemjvdm clemjvdm changed the title Render Project as SVG Enhancement: Render Project as SVG Dec 17, 2024
@Argmaster
Copy link
Owner

Thank you for your interest in PyGerber project. I am glad to receive enhancement suggestions. Right now I don't have capacity to implement this feature, I will look into it in the future. It is planned as part of release 3.0.0, but there is no exact timeline for said release. If you want, you can try implementing it yourself, I can provide help and general guidelines if needed. We are always happy to receive pull requests!

@clemjvdm
Copy link
Author

clemjvdm commented Dec 24, 2024

Thanks for your reply. I understand. I'd be happy to try and implement it. Where should I reach out for some guidance? The discussion board?

@Argmaster
Copy link
Owner

We can continue this discussion here, in comments.
In general what you should probably do is to use shapely representation of image to merge multiple images (geometries) into one image. Im not sure if shapely supports concept of z-index, you would need to verify it. After composing shapely geometry into one image you would likely be able to use existing shapely -> svg export implementation or something really similar.

Have a look at implementaiton details for existing svg and raster export code here:

If shapely doesnt provide z-index-like functionality, you could instead reimplement svg export and stack the geometry into one image, but this requires taking into account that different layers can have different size and offsets. Afaik svg should support z-index so at least this part should go smoothly.

To sum up, start by looking into existing svg export code and shapely vm to have general idea how we handle vector geometry and svg export, then have a look into raster exports with pillow to get an idea what we have to account for while exporting multiple images at once. Afterwards try figuring out if you can utilize shapely geometry union to merge geometry or svg format to merge multiple images into one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants