linebender / linebender/resvg

Add optional parameters to limit the maximum dimensions ---max-width, --max-height

Open
#647 9 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

Some svgs have a huge viewbox and I would need to limit the size of the png produced.
The current settings (-w and -h) allow this if the image is larger than the given values.
If the image is smaller then it will be enlarged.
The idea is therefore not to exceed a given dimension (optional).

I made the changes and created a git patch.

Be indulgent, it's the first time I do Rust ;-)
So you can do much better, but if it can make your job easier, I'd be happy ;-)

[add_max_width_height.patch](https://github.com/RazrFalcon/resvg/files/12081836/add_max_width_height.patch)

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

Review the attached add_max_width_height.patch alongside the existing -w and -h handling. Verify that the optional --max-width and --max-height behavior does not enlarge smaller SVGs, and test the resulting PNG dimensions with SVGs whose viewboxes exceed or fit within the limits.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, computer-graphics
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.