Sign In

How to "animate" images with parallax loops

18

Sep 27, 2024

(Updated: a day ago)

video generation guide
How to "animate" images with parallax loops

I’m writing this article to show how I make my "animations" since some people have asked me privately.

What am I talking about and what are these animations? Click Here

Attention:

  • In this post, I will not be teaching how to use Automatic1111 or ComfyUI.

  • You will need basic knowledge of CLI commands and Python.

  • The tutorial uses image-to-video (img-to-video) conversion.

  • You'll need an image saved on your computer (obviously 🫠).

  • I'm using Windows, but it's also possible on Linux; you’ll just need to adjust a few commands.


1. Download and install python from the official site (latest version):

https://www.python.org/downloads/

2. Download DephFlow package from pip (pip is installed with python):

1. Open CMD (press WIN + R, type "CMD", and hit Enter)
2. Paste the following command: pip install depthflow
3. Press Enter, and pip will automatically install DepthFlow

3. Navigate to the directory where your image is located:

1. 
Lets say my directory and my image name is:
    -> Directory: F:\stable-diffusion-webui\outputs\extras-images
    -> Image name: 00000.png
This will vary for you. In the next steps, I'll use these variables to illustrate the commands!

2. 
Open CMD (press WIN + R, type "CMD", and hit Enter)

3. 
Paste the command: 
cd <your_directory>
In my case: 
cd F:\stable-diffusion-webui\outputs\extras-images

4. 
Paste the command: 
python -m DepthFlow input -i <your image name> main -o .\loop_video.mp4
In my case: 
python -m DepthFlow input -i 00000.png main -o .\loop_video.mp4

5.
The program will start to calculate de depth map and generate the "animation"

6.
The result will be saved as "loop_video.mp4" in the same folder of your image (you can change the output name in the CLI)

Tips: Use images with depth (it makes it easier for the program to calculate, and the animations turn out better). Check other settings beyond the default by using the command: python -m DepthFlow config.

I plan to improve this article soon (though I’m not sure if it’s possible to edit after posting). But that’s it for now! ⭐

18