How do I change a video's background to white and turn it into a looping GIF?
Last updated: Nov-09-2026
- Key out the background color with
co_rgb:<color>,e_make_transparent:<tolerance>. - Put a white layer behind the subject by using a stretched 1x1 white pixel as an underlay (
u_). - Add
e_loopand a.gifextension.
co_rgb:0E80D8,e_make_transparent:20/u_docs:one_black_pixel/c_scale,co_white,e_colorize:100,fl_relative,h_1.0,w_1.0/fl_layer_apply/e_loop
The question
"I'm trying to change the background of this video to white, and then have it as a GIF that loops non-stop."
This recipe starts with a video filmed against a solid blue background, and produces an animated GIF in which the subject appears on a white background and repeats endlessly.
The original asset
The original video has a solid blue background and plays once:
The solution
The transformation has three parts, in separate components (separated by /):
-
Make the background transparent.
co_rgb:0E80D8is the color to remove, ande_make_transparent:20removes it with a tolerance of 20. The tolerance controls how closely a pixel has to match the color to be removed, so raise it if bits of the background remain, and lower it if parts of the subject disappear. Use the color of your own background, as a hex value without the#. -
Place white behind the subject. Make a layer from a 1x1 pixel image, stretch it to the full size of the video (
c_scale,fl_relative,h_1.0,w_1.0), and color it white (co_white,e_colorize:100). Because you add it withu_(underlay), it goes behind the video instead of on top of it. -
Loop the animation. Add
e_loopand use a.giffile extension for the public ID. With no value,e_looploops the GIF indefinitely.
- The example uses the pixel image
docs/one_black_pixel. Replace it with the public ID of a 1x1 pixel image in your own product environment, with colons in place of any slashes. You can download the 1x1 pixel image and upload it to your product environment. The color doesn't matter, becauseco_white,e_colorize:100recolors it. - Animated GIFs can be large. The example lowers the frame rate to 10 frames per second (
fps_10) to keep the file size down. You can also scale the GIF down, for example withc_scale,w_480. For more options, see Animated images.
How it works
| Component | What it does |
|---|---|
co_rgb:0E80D8,e_make_transparent:20 |
Makes pixels matching the background color transparent. |
u_docs:one_black_pixel/c_scale,fl_relative,h_1.0,w_1.0 |
Adds the 1x1 pixel image as an underlay, and scales it to 100% of the video width and height. |
co_white,e_colorize:100 |
Turns the pixel white. |
fl_layer_apply |
Applies the underlay. |
e_loop |
Makes the GIF repeat indefinitely. |
.gif extension |
Delivers the video as an animated GIF. |
To loop a fixed number of times instead, add the number of additional loops after e_loop. For example, e_loop:2 plays the animation three times in total.