linebender / linebender/resvg

Enforce width/height arguments to be respected

Open
#779 6 comments 1 reaction 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

Use-case: The SVG icon has size 20x30, the online service expects uploaded icon to be PNG with size 64x64px.

Current behavior: The width/height arguments is not respected and work more like a recommendation:

$ resvg --width 64 --height 64 in.svg out.png
$ file out.png
out.png: PNG image data, 43 x 64, 8-bit/color RGBA, non-interlaced

Expected result: The width/height arguments define exact image size. Icon is centered in the resulted image.

Example:

<svg width="20" height="30" viewBox="0 0 20 30" xmlns="http://www.w3.org/2000/svg">
  <circle cx="10" cy="15" r="5" fill="tomato"/>
</svg>

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 by reproducing the reported command with the provided SVG and inspect the width/height handling used by the resvg CLI and renderer. The change is complete when --width 64 --height 64 produces an exactly 64x64 PNG with the icon centered, and the relevant rendering behavior is covered by tests.

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
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.