# How to obtain transparent animated gif via Export?

I have the following code to create animated GIFs:

ClearAll["*"];
xmin = -3;
xmax = 4;
ymin = -10;
ymax = 3;
line1 = Line[{{xmin, ymin}, {xmin, ymax}}];
line2 = Line[{{xmax, ymin}, {xmax, ymax}}];
slides = 8;
cmin = -10;
cmax = 5/2;
v = Table[Manipulate[
Plot[{1/3 x^3 + x^2 + x - (2 x^2 + 4 x), c}, {x, xmin, xmax},
PlotStyle -> {Blue, Red}, AspectRatio -> GoldenRatio,
PlotRange -> {{xmin, xmax}, {ymin, ymax}},
Epilog -> {Directive[{Green, Green}], line1, line2},
Background -> None], {{c, k/slides, "Constant:"}, cmin, cmax}],
{k, cmin*slides, cmax*slides}];
v = Join[v[[1 ;; Dimensions[v][[1]] - 1]], Reverse[v]];


When I use:

Export["testManip007.gif", v]


I obtained:

In order to get transparent background gif, I tried the following which worked for other cases:

Export["testManip007t.gif", v, "TransparentColor" -> White]


but the resulted is:

Export["testManip003t.gif", v, "DisplayDurations" -> 0.1,
"TransparentColor" -> White]


always causes error message and empty output.

How to solve the problems?

• I tried setting Background explicitly to White but with no improvement to the exported gif. I then set both Background and "TransparentColor" to Yellow, which improved the appearance of the slider but not the plot itself. Nov 18, 2014 at 6:35
• Setting "Interlaced" option to True or False does not have an effect. Nov 18, 2014 at 6:59
• You can't. Animations are realized through frames, i.e., the next frame appears through the former if you set "TransparentColor" -> White. My recommendation stay with white background.
– user9660
Dec 4, 2014 at 17:29

Note for Version 11.1: As commented by LCFactorization the option setting

"TransitionEffect" -> Background


is no longer working (error message + nothing exported).

The solution is to use "TransitionEffect" -> "Background" instead, which doesn't produce the desired result in version 10.4 and earlier.

By default the frames of a GIF are stacked on top of each other. One can change this behavior using the Export option "TransitionEffect" -> Background:

Export["testManip007t.gif", v, "TransparentColor" -> White, "TransitionEffect" -> Background]


The default setting is "TransitionEffect" -> None.

• Do you know what other TransitionEffect options are available? From Import[#, {"GIF", {"TransitionEffect"}}] & I have seen only None, False and Background. Jun 1, 2017 at 16:41
• @rhermans I didn't come across any other option values either. I'm also not aware of something else the GIF file specifications would provide. It's a relative simple file format and the Mathematica exporter is rather primitive. Jun 1, 2017 at 17:58
• This option seems no longer work in the latest version 11.1? Jul 14, 2017 at 13:52
• @LCFactorization You are correct, thanks for pointing that out. In version 11.1 you have to use "Background" instead of Background as the option value. Jul 14, 2017 at 16:29
• @Karsten7. Hello again! So, I contacted Wolfram Technical Support and they just confirmed that there is no way to export a GIF with a transparent background using the old "TransitionEffect" -> Background trick. They tell me they are "looking to release a new version of Mathematica that has [the "DisposalOperation"` option] included in the Export functionality", but right now it only works for importing GIF files. So, I'll have to wait I guess, or maybe reinstall an older version of Mathematica. I'll keep you posted as soon as I learn anything new. And thank you for your help! May 21, 2018 at 22:54