Designed for DALL·E 2, this program facilitates the creation of mesmerizing “infinite” zooms.
pip install -r requirements.txt
- Create a base image by giving DALL·E 2 a prompt of your choice (link) and dump it into the
images
folder. - Feed the base image into
main.py
to create an outcropped version (named….zoomed.png
)python main.py
- Upload the outcropped image back to the DALL·E 2 website.
- Hint: Look for “Or, upload an image to edit”
- Repeat steps 2. and 3. as often as you like.
- Run
generate_video_manim.py
to create the zoom animation:manim generate_video_manim.py
- Look for “File ready at” in the console output for the video's location.
- See
manim.cfg
for configuration options like fps, resolution, etc. - You can override the configuration options by passing them as arguments. For example, for a low-quality preview:
manim -r 512,512 --fps 10 generate_video_manim.py
🛈 These were not actually generated with this program, but are representative of its output.
- Inside Her Head - DALLE-2 Uncrop Animation
- Feel free to add yours by submitting a pull request!
In each time interval, we want to zoom out by a factor of 3. That is, what filled the (quadratic) screen before, now occupies a ninth of the screen. This leads to an exponential function:
scale = BASE_SIZE / (3^t) = BASE_SIZE * (3^-t)
When inpainting, DALL·E 2 does not preserve the original image completely. Especially the borders are modified, and the whole image loses some detail (rememer, the base image's edge length is now a third). Here's a visualization of the difference using GIMP's “Grain extract” mode, cropped to the base image size for clarity:
Therefore, when naively inserting the more detailed base image into the outcropped image, we get a visible border.
We can improve on this by effectively cropping the inner image a bit. For convenience reasons, we actually make a padding area inside the inner image transparent. Furthermore, we fade out the inner image while we zoom away from it.
🛈 This could use some fine-tuning.
- Only now did I find out about https://dalletools.art/zoom-animation – a website that does pretty much the same thing, but with a nice graphical user interface. ✨
- There's a neat tutorial on YouTube that shows how to do what this program does using Photoshop and After Effects: https://www.youtube.com/watch?v=tux81Z3uXMY
- Thanks to OpenAI for making DALL·E 2 available. 💛💙💚❤️💜
- Thanks to Grant Sanderson (3Blue1Brown) and the Manim community. 💙💙💙🤎
- Props to Powers of Ten™ (1977) for inspiring my demo images.
- Fine-tune fading and cropping for even smoother transitions.
- Call DALL·E 2 via API instead of letting the user do it.
- Currently, there is no official API, though. But there's this.