Create GIF maker using Streamlit and Python

Sai Prakash
3 min readFeb 17, 2023

--

Have you ever wanted to convert your video files to animated GIF images? If so, you may already be doing it. I know there are many tools out there, some of which are free and others which are available for purchase. However, wouldn’t it be cool if you could make your very own using open source tools and include it in your portfolio of projects? If that sounds like fun, let’s get started.

Before we dive in, let’s take a look at the animated GIF maker we will be building. You can access the app at here. The app is simple to use. To upload your video file, drag and drop it onto the left-hand side of the screen. You will see metrics loaded based on the movie file that you uploaded. You can adjust the playback speed, export duration, and frames per second. You can preview the file at any given time point and set the duration of the output file. Once you are satisfied with the parameters, click the “Generate Animated GIF” button to create the animated GIF. The preview will show on the right-hand side of the screen, and you can download the GIF file.

Make a GIF app overview

Let’s take a look at how to build the app. The code is available here, and it contains the Streamlit app file and requirements file. We will be using Streamlit for the web app, Moviepy for the conversion of the video into the animated GIF, and imageio-ffmpeg wrapper for the video processing. The requirements file lists these dependencies.

The Streamlit app file consists of functionality and the UI part which is provided in the Make a GIF repository. The app is easy to use and is written in pure Python with a front-end using Streamlit. Once you have set up your environment and installed the dependencies, you can run the app. The app will display the upload field on the left-hand side of the screen, along with the file metrics that were loaded based on the movie file that you uploaded. You can adjust the playback speed, export duration, and frames per second. You can preview the file at any given time point and set the duration of the output file. Once you are satisfied with the parameters, click the “Generate Animated GIF” button to create the animated GIF. The preview will show on the right-hand side of the screen, and you can download the GIF file.

GIF generated using this app

In conclusion, this app is an excellent example of how easy it is to create a GIF maker using open source tools. It’s a fun project to try out, and you can include it in your portfolio of projects. The Streamlit and Python combination make it easy to create a front-end with all the necessary controls to create an animated GIF. The app is straightforward to use, and the code is easy to understand, making it a great starting point for other projects.

App link : https://saispr-streamlit-dashboard-streamlit-app-xymzzq.streamlit.app/

Credits : Chanin Nantasenamat

Thanks for the read. So what do you guys think? I’ll be interested to know your thoughts on it. I hope I’ve given you a brief idea about creating a GIF maker app using Streamlit and Python. Give it a 💚, if you like this post for extra motivation. I’m always open to your suggestions and queries.

--

--

Sai Prakash
Sai Prakash

Written by Sai Prakash

Data Analyst@Sargaa | ML Practitioner | Game Developer

Responses (1)