linebender / linebender/resvg

`resvg` does not isolate background properly

Open
#1,069 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
4.1k
Forks
348
Avg merge
1d 14h
Merged PRs (30d)
3

Description

The following SVG:

```svg

```

Renders fine with default arguments:

Image

but as soon as I add `--background white` I get the following:

Image

I think this is because we just fill the pixmap with the white color and then render the SVG on top of it, with this white color as the initial backdrop. However, I think what should be done is that we render against a transparent backdrop first and then composite the final result onto the white pixmap. This usually doesn't matter for src-over compositing, but if you have SVGs with blending, it does matter in which order you apply the operations.

Contributor guide

No contributing guide indexed for this repository

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.

Research direction

Start at the CLI handling for `--background` and reproduce the issue with the SVG in the report, comparing default rendering with `--background white`. Trace how the background is applied relative to SVG blending; done means the white background no longer changes the blended result unexpectedly.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.