-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resizing images and videos in a jupyter notebook #1312
Conversation
I made a PR to your branch, updating the dependencies in poetry which should hopefully fix the tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it also possible to use relative heights and widths instead of pixel values?
that seems to be a known issue:
I think the height should always be defined by the video shape and only with width should change, otherwise, the video would look distorted. And for the widths, I prefer absolute pixel values over relative pixel values. |
poetry.lock
Outdated
@@ -40,15 +40,15 @@ name = "appnope" | |||
version = "0.1.2" | |||
description = "Disable App Nap on macOS >= 10.9" | |||
category = "main" | |||
optional = true | |||
optional = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@naveen521kk : Is it ok when the optional parameter is false?
I don't know why this happend
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you ran poetry lock
or poetry update
and this happened it should be fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Darylgolden : Did you run poetry lock
or poetry update
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did poetry add
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is also fine, but in particular since this is a dependency for jupyter-lab/Colab, it should be placed in the extras (see L57 of pyproject.toml)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, that is possible, but I think it is also ok to be in the main dependencies, no?
I am thinking of the case that someone had already installed jupyter notebook and then installs manim, but has no jupyter lab, it would be nice when this cell magic works out of the box. Or are the extras automatically installed with pip install manim
? If it would work automatically, then we can add it to the extras.
Further, I have a lot of extra installed packages in my manim environment, and I am afraight that when I type poetry update
that these will be also added to the poetry file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to worry about extra installed packages in your manim environment. poetry update
will only update the versions of the packages listed in pyproject.toml.
The extras are not automatically installed via pip, nor are they by poetry.
In either package manager, you must specify the extra e.g.:
poetry install -E jupyterlab
pip install manim[jupyterlab]
Since jupyterlab is not a requirement and is already part of the extras, its dependencies should also be extras.
Co-authored-by: Naveen M K <naveen@syrusdark.website>
@jsonvillanueva : Thanks for updating the poetry file.
Can you have a look at that? |
I think absolute pixel values are fine for now, but I am totally fine if someone wants to add relative values in a future pr. |
I think @behackl will have better feedback on this front of 4k (I don't own a 4k monitor). As for the config.media_width fields, it's still plausible to do in this PR as it's really only a couple lines of code that need to be changed; however, I'm not sure if it's good to break the behavior that @Darylgolden just added in the previous PR related to video sizes where dynamic sizing WAS supported... Also it seems like with this implementation there would need to be new config variables (particularly for config.min_media_width and config.max_media_width) based on the new toggle buttons. |
Personally, I think there should be a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, are you still interested in working on this? If not, I think we can merge this as is and make the changes in future PRs.
Right now, I have other priorities. |
@jsonvillanueva Can we merge this PR as is? The relative sizing and use of the global config can be worked on later. |
Sure; just handle the poetry conflicts @kolibril13 |
# Conflicts: # poetry.lock # pyproject.toml
Resolved.
|
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
I've looked at this again today; it's been a while. :-) While I like the general idea of supporting better image viewers within Jupyter notebooks, I am against "reinventing the wheel" here. I feel we should rather push towards compatibility with an image viewing library (like, e.g., Napari) instead of implementing it ourselves. I'm happy to continue discussion about it here, but in the spirit of cleaning up, I'll close this PR for now. (Please re-open if you disagree!) |
I was now working a while with manim in jupyter notebook, and the biggest issue I see is the inconsistency with the output width of videos/images. Currently, one can only scale videos, and also only in advance, not afterwards.
Images can be only scaled by using the quality flags, but in a notebook with let's say 20 scenes, this causes a mix of large and small cells, which don't look very organized.
This pr will enable three options, which are in my opinion very useful: 1. a thumbnail view that does not take a lot of space 2. a larger view where one can see the scene nicely, 3. A view where the video/image is displayed pixel by pixel. All options can be also selected after the video is rendered.
Additionally, I added a Download button for the images.
EDIT: tests are failing, can someone tell me how to add
ipywidgets
as a dependency to the repo?https://user-images.githubusercontent.com/44469195/114287021-fc48c780-9a63-11eb-8d35-ef2695e2f0e0.mov
Testing Status
Further Comments
Checklist
Reviewer Checklist