_loop = function _loop(_i3) {
              var localPaletteRequired = !framesUsingGlobalPalette.has(_i3);
              var palette = localPaletteRequired ? [] : globalPalette;
              var pixelPaletteIndex = new Uint8Array(pImg.width * pImg.height);

              // Lookup table mapping color to its indices
              var colorIndicesLookup = {};

              // All the colors that cannot be marked transparent in this frame
              var cannotBeTransparent = new Set();

              for (var _k = 0; _k < allFramesPixelColors[_i3].length; _k++) {
                var _color = allFramesPixelColors[_i3][_k];
                if (localPaletteRequired) {
                  if (colorIndicesLookup[_color] === undefined) {
                    colorIndicesLookup[_color] = palette.length;
                    palette.push(_color);
                  }
                  pixelPaletteIndex[_k] = colorIndicesLookup[_color];
                } else {
                  pixelPaletteIndex[_k] = globalIndicesLookup[_color];
                }

                if (_i3 > 0) {
                  // If even one pixel of this color has changed in this frame
                  // from the previous frame, we cannot mark it as transparent
                  if (allFramesPixelColors[_i3 - 1][_k] !== _color) {
                    cannotBeTransparent.add(_color);
                  }
                }
              }

              var frameOpts = {};

              // Transparency optimization
              var canBeTransparent = palette.filter(function(a) {
                return !cannotBeTransparent.has(a);
              });
              if (canBeTransparent.length > 0) {
                // Select a color to mark as transparent
                var transparent = canBeTransparent[0];
                var transparentIndex = localPaletteRequired
                  ? colorIndicesLookup[transparent]
                  : globalIndicesLookup[transparent];
                if (_i3 > 0) {
                  for (var _k2 = 0; _k2 < allFramesPixelColors[_i3].length; _k2++) {
                    // If this pixel in this frame has the same color in previous frame
                    if (
                      allFramesPixelColors[_i3 - 1][_k2] === allFramesPixelColors[_i3][_k2]
                    ) {
                      pixelPaletteIndex[_k2] = transparentIndex;
                    }
                  }
                  frameOpts.transparent = transparentIndex;
                  // If this frame has any transparency, do not dispose the previous frame
                  previousFrame.frameOpts.disposal = 1;
                }
              }
              frameOpts.delay = props.frames[_i3].delay / 10; // Move timing back into GIF formatting
              if (localPaletteRequired) {
                // force palette to be power of 2
                var _powof = 1;
                while (_powof < palette.length) {
                  _powof <<= 1;
                }
                palette.length = _powof;
                frameOpts.palette = new Uint32Array(palette);
              }
              if (_i3 > 0) {
                // add the frame that came before the current one
                gifWriter.addFrame(
                  0,
                  0,
                  pImg.width,
                  pImg.height,
                  previousFrame.pixelPaletteIndex,
                  previousFrame.frameOpts
                );
              }
              // previous frame object should now have details of this frame
              previousFrame = {
                pixelPaletteIndex: pixelPaletteIndex,
                frameOpts: frameOpts
              };
            }
@method saveCanvas
 @param  {String} [filename]
 @param  {String} [extension]