Skip to content

Instantly share code, notes, and snippets.

Last active Jun 21, 2021
What would you like to do?
Export GIF with SimSwap


At the start of the notebook, ensure the logo is removed:

%cd /content
%rm -rf SimSwap
!git clone
%cd SimSwap
!git checkout no-logo

If you want to apply SimSwap to a GIF, there will be an error because the input video has no audio.

To fix this issue, collate the temporary image outputs at the end of the notebook:

import os 
import cv2
import glob
from import ImageSequenceClip

input_fname = '/content/SimSwap/video.gif'
temp_results_dir = '/content/SimSwap/tmp/'
output_fname = '/content/output.gif'

video_path = input_fname
video = cv2.VideoCapture(video_path)
fps = video.get(cv2.CAP_PROP_FPS)

path = os.path.join(temp_results_dir,'*.jpg')
image_filenames = sorted(glob.glob(path))

clips = ImageSequenceClip(image_filenames,fps = fps)

To optimize the file size (in MB) of the GIF, you can upload it to a website like

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment