svg with improperly positioned tiled images

Open
#400 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python

Research direction

Start with the reported SVG containing two tiled images and reproduce the result through the shown cairosvg.svg2png call, testing both embedded data URIs and external URLs. Compare the converted PNG's image positions with the SVG preview; done means both images are rendered at their intended locations.

Written by the indexing model from the issue text.

Description

Hi, I have an .svg file (the_svg_file) which contains 2 images (I tried both embedded data uri using base64 string and an external website url). When previewed, the images work fine:

Screenshot 2023-09-02 at 12 57 46 PM

Using cairosvg to convert this svg file to a png however results in the images appearing but not where they're supposed to be:

Screenshot 2023-09-02 at 1 02 32 PM

I'm using the following code to invoke cairosvg, to wit:

>>> import cairosvg
>>> cairosvg.svg2png(
    bytestring=the_svg_file.read_bytes(), 
    write_to=output_file.as_posix(), 
    unsafe=True
)

Wondering if I'm missing anything in the command to ensure that I get parity between the raw svg and the target output file, post-conversion.

Dominant language
Python
Stars
959
Forks
172
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Kozea/CairoSVG

All issues in Kozea/CairoSVG

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.