ImageOptim / ImageOptim/ImageOptim

viewBox stripped from SVG images

Open
#298 6 comments 9 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
10k
Forks
478
PR merge metrics
No merged PRs in 30d

Description

ImageOptim always removes the viewBox attribute from SVG images. It's necessary for predictable scaling in the browser. I can't think of a reason why I'd actually want to remove the viewBox attribute, especially as a default option. I don't think SVGO removes it by default. Can an option be added to keep it?

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

Locate the SVG image optimization path and its option handling, then reproduce how ImageOptim currently removes viewBox. Check how SVGO treats the attribute and define completion as an option that preserves viewBox when enabled, with the default behavior made explicit.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.