Fix: Correct portrait orientation bug in manim init project --default
#4440
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview: What does this pull request change?
Fixes the configuration file generated by
manim init project --default
to use correct landscape orientation (854×480) instead of portrait (480×854).Motivation and Explanation: Why and how do your changes improve the library?
Closes #4184
When running
manim init project --default my-project
, the generatedmanim.cfg
file had incorrect pixel dimensions that resulted in a portrait orientation (480×854) instead of the expected landscape orientation (854×480). This caused distorted rendering with scenes appearing compressed horizontally.Root cause: Two bugs in
/manim/cli/init/commands.py
:CFG_DEFAULTS["resolution"]
was set to(854, 480)
in (width, height) order, inconsistent withselect_resolution()
which returns tuples in (height, width) orderupdate_cfg()
function was incorrectly assigningvalue[0]
topixel_width
andvalue[1]
topixel_height
, causing the values to be swappedFix:
CFG_DEFAULTS["resolution"]
from(854, 480)
to(480, 854)
to match the (height, width) conventionupdate_cfg()
to correctly assignvalue[0]
(height) topixel_height
andvalue[1]
(width) topixel_width
Now the generated config correctly produces landscape orientation matching Manim's default coordinate system.
Links to added or changed documentation pages
N/A - This is a bugfix with no documentation changes needed.
Further Information and Comments
Testing:
test_manim_init_project
passes ✅manim init project --default testproject
now generates correct config withpixel_width=854, pixel_height=480
Reviewer Checklist