Creating Infinite Zoom Art with Stable Diffusion

An infinite zoom art is a visual art technique that creates an illusion of an infinite zoom-in or zoom-out on an image. You can easily use Stable Diffusion, an AI art generator, to create one.

You will learn how to make an infinite zoom art like this:

We will cover

  • Software setup
  • A step-by-step guide to creating your first infinite zoom
  • Guide for generating good results
  • Advanced options

Stable Diffusion Software

We will use AUTOMATIC1111 Stable Diffusion WebUI to create infinite zoom videos. It is a popular and free open-source software. You can use this GUI on WindowsMac, or Google Colab.

Check out the Quick Start Guide if you are new to Stable Diffusion.

Check out the AUTOMATIC1111 Guide if you are new to AUTOMATIC1111.

You will need to install the infinite zoom extension in AUTOMATIC1111.

Installing Infinite Zoom on Google Colab

If you use our Colab Notebook, enter the following URL in the Extensions_from_URL field.

https://github.com/v8hid/infinite-zoom-automatic1111-webui

Installing Infinite Zoom on Windows or Mac

  1. Start AUTOMATIC1111 Web-UI normally.

2. Navigate to the Extension Page.

3. Click the Install from URL tab.

4. Enter the following URL in the URL for extension’s git repository field.

https://github.com/v8hid/infinite-zoom-automatic1111-webui

5. Wait for the confirmation message that the installation is complete.

6. Restart AUTOMATIC1111.

A simple first example

You can use this quick example to test your setup and ensure everything works correctly.

Step 1: Download an inpainting model

You should use an inpainting model for a reasonable result. Let’s use the Dreamshaper Inpainting model. Download the model file and put it in the folder:

stable-diffusion-webuimodelsStable-diffusion

Step 2: Select the inpainting model

Select the inpainting model in the Stable Diffusion checkpoint dropdown menu.

Step 3: Review settings and press generate

You should see the Common Prompt Prefix, the Prompt Start at second, the Common Prompt Suffix, and the Negative Prompt populated with the default values. We will explain them later, but the Prompt Start at second is the prompt that is switched to at that time.

Press Generate.

After a brief wait, you should get a video like this.

How does Infinite Zoom work?

Now, it’s a good time to pause and understand what happened.

The prompt of the initial image is a combination of the common prefix, prompt, and the common suffix. The subject is written in the prompt and has changed at 2 sec, 3 sec, and 5 sec.

So, the initial image is generated with the prompt at time 0 using the inpainting model.

In the next frame, the initial image is shrunk slightly to create the illusion of zooming out. Now, you have created a small frame of empty space around the shrunk image. The extension inpaints the empty space using the same prompt.

The process repeats itself until you reach 2 sec, where you switch to the next prompt. Now, you use the new prompt for inpainting.

And you get the idea.

Step-by-step guide for Infinite Zoom

Now you have verified that your setup is working, let’s go through a slightly more advanced example.

We used the inpainting model in the previous example to generate the initial image. It is not the best because an inpainting model is trained to fill in a missing part of an image, not directly creating one.

You should use a pairing model to generate the first image for the best result. For example, use the DreamShaper 8 model to create the initial image and the DreamShape 8 inpainting model to create the infinite zoom video.

Step 1: Generate the initial image

Go to the txt2img page in AUTOMATIC1111.

  • Prompt and Negative Prompt:

beautiful woman, yellow hair, in temple, magical scene, shining eyes, dazzling glow, 8k, intricate, elegant, highly detailed, majestic, digital photography, art by artgerm and ruan jia and greg rutkowski, hdr

BadDream

(Note: BadDream is a negative embedding for DreamShaper.)

  • Sampling Method: DPM++ 2M Karras
  • Sampling steps: 20
  • Width: 768
  • Height: 512

Press Generate. We get the initial image.

Step 2: Enter Infinite Zoom settings

Go to the Infinite Zoom page in AUTOMATIC1111.

Main tab

Select the Main tab.

Batch Count is the number of videos you are going to make each time you press the Generate button. Keep it as 1.

Total video length [s] is the total length of the video. Enter 12 sec for this video.

This extension breaks the prompt into 3 parts:

  • Common Prompt Prefix: Beginning part of the prompt. This is common to all frames of the video.
  • Prompt: Middle part of the prompt. This can be changed at any different time in the video.
  • Common Prompt Suffix: Ending part of the prompt. Similar to the prefix, all frames use the same prompt suffix.

Now you know you can have a fixed and variable part in the prompt. Let’s break the prompt of the initial image into two parts:

  • Subject: the variable part. This can be changed at any time point, defined in the table.
  • Style: the fixed part. We keep the same style throughout the video.

The subject part of the initial prompt is

beautiful woman, yellow hair, in temple

The style part of the initial prompt is

magical scene, shining eyes, dazzling glow, 8k, intricate, elegant, highly detailed, majestic, digital photography, art by artgerm and ruan jia and greg rutkowski, hdr

We will use the subject in the middle, variable part of the prompt. We will use the style in the common part of the prompt.

In the table, enter:

Common Prompt Prefix: (leave empty)

Enter the following prompts for different time points in the table.

Start at second Prompt
0 beautiful woman, shining eyes, yellow hair, in temple
2 temple in waterfall
6 close up of giant waterfall in jungle
Variable part of the prompt.

I found it produces better results when you have a gradual transition of the subject

  • 0 second: woman, temple
  • 2 second: temple, waterfall
  • 6 second: waterfall, jungle

Common prompt suffix:

magical scene, dazzling glow, 8k, intricate, elegant, highly detailed, majestic, digital photography, art by artgerm and ruan jia and greg rutkowski, hdr

Negative Prompt:

BadDream

Output width: 768

Output height: 512

Sampling Steps for each outpaint: 20

Outpainting tab

Switch to the outpainting tab.

Set the Mask Blur all the way up to 64. The Mask Blur is the amount of blurring near the edge of the newly created empty space. A higher value helps to increase the consistency of inpainting.

Step 3: Generate Infinite Zoom video

We will keep the rest of the parameters as default. Press Generate to create the video.

Step 4: Convert to animated GIF (Optional)

You can use this free service to convert the MP4 video to an animated GIF:

https://ezgif.com/video-to-gif

Here’s one result.

Here’s another one.

Tips

Inpainting models

DreamShaper is not the only model/inpainting model you can use. Here’s an extended list

Zoom settings

Set zoom in or out in Video > Zoom mode.

Set zoom speed in Video > Zoom speed

Color correction setting

Uncheck Settings > Img2img > Apply color correction to img2img results to match original colors.

aizmin: