linebender / linebender/resvg

Separate options for rendered SVG size and total image canvas size

Open
#825 3 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

Currently we are able to provide render size via `--width` and `--height` options but there is no way to produce a padded png from a non-padded svg.
My use case revolves around generating a bunch of website favicons from an svg file.
At first I tried to create another padded svg file which references the original file with `` to avoid duplication but turns out [external file references are not supported yet](https://github.com/RazrFalcon/resvg/issues/6).
Then I tried to see if it's possible to somehow specify render and final image sizes separately but looks like [it's also not possible currently](https://github.com/RazrFalcon/resvg/issues/779).

**Feature Request**
Introduce `--render-width` and `--render-height` to specify what size the svg will be rendered. If the render size is smaller then image size, it is centered. If the render size is bigger, it is centered but also cropped.

We can think about introducing a `--scale-mode=(scale,fill,stretch,none)` option later on if necessary.

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 tracing the CLI handling for the existing --width and --height options through the SVG rendering path. Define how separate render and canvas dimensions should center or crop the output, then verify the behavior with a non-padded SVG rendered to a padded PNG at the requested sizes.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, computer-graphics
Issue type
Feature
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.