ManimCommunity / ManimCommunity/manim
SVGMobject doesn't care for width and height defined in SVG
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 40.9k
- Forks
- 3.1k
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 25
Description
## Description of bug / unexpected behavior
While playing around with https://github.com/ManimCommunity/manim/pull/1361, I have an SVG, [a4dae70e0eb51266.txt](https://github.com/ManimCommunity/manim/files/6358293/a4dae70e0eb51266.txt), converted to `.txt`, where the width and height element are not taken into account while displaying.
Using Inkscape's, export to png.

Trying the same with this Code in Manim
```py
from manim import *
config["background_color"] = WHITE
class HelloWorld(Scene):
def construct(self):
text = SVGMobject('a4dae70e0eb51266.svg')
self.add(text)
```
I get rendering with `manim -psql test.py`

## Expected behavior
What I am expecting is that the PNG rendered using Manim similar to rendered using Manim to match that of Inkscape. With bounding boxes and width and height element matching that of the SVG.
## How to reproduce the issue
Code for reproducing the problem
```py
from manim import *
config["background_color"] = WHITE
class HelloWorld(Scene):
def construct(self):
text = SVGMobject('a4dae70e0eb51266.svg')
self.add(text)
```
## Additional media files
Images/GIFs

## Additional comments
On the other hand, I would like SVGMobject to draw things with the same size as the SVG itself and give a warning or something asking the user's to scale if the SVG has gone out of the screen or something. That would be super helpful for the `Text` and `Tex` objects because the consistency of size would be the size. For example, the `size` parameter will never work as expected with `Text` because the SVG is scaled and not drawn according to the size.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the SVGMobject entry point and run the provided HelloWorld reproduction using a4dae70e0eb51266.svg, then compare its output with the Inkscape PNG. Trace how the SVG width, height, and bounding box are handled; done means Manim renders the SVG at the expected dimensions or clearly warns when scaling is needed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100