Re: Export Gif animation bug?
- To: mathgroup at smc.vnet.net
- Subject: [mg39159] Re: [mg39148] Export Gif animation bug?
- From: Dale Horton <daleh at wolfram.com>
- Date: Fri, 31 Jan 2003 19:57:18 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
The color problems are in the colormap of the GIF. There are ConversionOptions that control the colormap. Either can be used to fix this problem. By default, a single colormap is used for the entire animation. You can create a colormap for each frame with Export[..., ConversionOptions -> {"GlobalColorReduction" -> False}] Or you can override the automatic colormap with one of your own. Here's an example using "web safe colors". Export[..., ConversionOptions -> {"ColorReductionPalette" -> Table[RGBColor[i, j, k], {i, 0, 1, 0.2}, {j, 0, 1, 0.2}, {k, 0, 1, 0.2}]}] At 03:37 AM 1/31/2003, Don Taylor wrote: >I think I've found a bug in exporting GIF animation >(Mathematica Version 4.0.2.0 under Windows 98 with MS patches) > >I don't know what the problem is with this. I've trimmed down what >I'm doing to what seems to be the bare minimum that shows the bug. >Tiny changes in the value of z or in the step size for the table >will make the background of the gif dark black or brilliant green, >change the resulting file size by a factor of 16x, etc. These three >examples show a sample of the range of behavior that I've seen with this. > >This simulates some axes and then draws a moving point which is >colored green at the bottom of each cycle and black elsewhere. > >All these examples are identical code, except for the value of z. >It takes a couple of minutes to generate each example. > >111 kbytes and what seems to be pretty much a correct plot > >z = 1; Export["1.gif", Table[Graphics3D[{ > Line[{{0, 1, 0}, {0, -1, 0}}], Line[{{0, 0, z}, {0, 0, -z}}], > Line[{{0, 0, 0}, {4Pi, 0, 0}}], > If[Sin[t] <= -0.8, RGBColor[0, 1, 0], RGBColor[0, 0, 0]], > Point[{t, Cos[t], z Sin[t]}]}, > PlotRange -> {{0, 4Pi}, {-1.05, 1.05}, {-1.05z, 1.05z}}, > ImageSize -> 800, Boxed -> False], {t, 0, 4Pi, Pi/16}], "GIF"] > >1598 kbytes! with bright green graph and lots of artifacts scattered >across the entire graph as it displays > >z = 2; Export["2.gif", Table[Graphics3D[{ > Line[{{0, 1, 0}, {0, -1, 0}}], Line[{{0, 0, z}, {0, 0, -z}}], > Line[{{0, 0, 0}, {4Pi, 0, 0}}], > If[Sin[t] <= -0.8, RGBColor[0, 1, 0], RGBColor[0, 0, 0]], > Point[{t, Cos[t], z Sin[t]}]}, > PlotRange -> {{0, 4Pi}, {-1.05, 1.05}, {-1.05z, 1.05z}}, > ImageSize -> 800, Boxed -> False], {t, 0, 4Pi, Pi/16}], "GIF"] > >72 kbytes with entire graph nearly completely black > >z = N[\[ExponentialE]]; Export["e.gif", Table[Graphics3D[{ > Line[{{0, 1, 0}, {0, -1, 0}}], Line[{{0, 0, z}, {0, 0, -z}}], > Line[{{0, 0, 0}, {4Pi, 0, 0}}], > If[Sin[t] <= -0.8, RGBColor[0, 1, 0], RGBColor[0, 0, 0]], > Point[{t, Cos[t], z Sin[t]}]}, > PlotRange -> {{0, 4Pi}, {-1.05, 1.05}, {-1.05z, 1.05z}}, > ImageSize -> 800, Boxed -> False], {t, 0, 4Pi, Pi/16}], "GIF"] > >I searched newsgroup postings and Wolfram and didn't find any mention >of such behavior. I presume this is a bug in the gif export code. > >If anyone can confirm that this is a bug and that it has been fixed >that would be good. If anyone can describe a dependable workaround >for the moment that would be even better, waiting a good part of >an hour for an animation to grind out and then discovering that it >is another "black cat in a dark room" is getting a little old. > >Thank you -Dale