internal void StoreFrame(RenderTexture renderTexture)
        {
            // convert to Texture2D
            var tempTexture =
                new Texture2D(renderTexture.width, renderTexture.height, TextureFormat.RGBA32, false)
            {
                hideFlags  = HideFlags.HideAndDontSave,
                wrapMode   = TextureWrapMode.Clamp,
                filterMode = FilterMode.Bilinear,
                anisoLevel = 0
            };

            RenderTexture.active = renderTexture;
            tempTexture.ReadPixels(new Rect(0, 0, renderTexture.width, renderTexture.height), 0, 0);
            RenderTexture.active = null;

            var frame = new GifFrame
            {
                Width  = tempTexture.width,
                Height = tempTexture.height,
                Data   = tempTexture.GetPixels32()
            };

            StoredFrames.Enqueue(frame);
        }
        internal void StoreFrame(RenderTexture renderTexture, double resizeRatio)
        {
            var newWidth  = Convert.ToInt32(renderTexture.width * resizeRatio);
            var newHeight = Convert.ToInt32(renderTexture.height * resizeRatio);

            renderTexture.filterMode = FilterMode.Bilinear;

            var resizedRenderTexture = RenderTexture.GetTemporary(newWidth, newHeight);

            resizedRenderTexture.filterMode = FilterMode.Bilinear;

            RenderTexture.active = resizedRenderTexture;
            Graphics.Blit(renderTexture, resizedRenderTexture);

            // convert to Texture2D
            var resizedTexture2D =
                new Texture2D(newWidth, newHeight, TextureFormat.RGBA32, false)
            {
                hideFlags  = HideFlags.HideAndDontSave,
                wrapMode   = TextureWrapMode.Clamp,
                filterMode = FilterMode.Bilinear,
                anisoLevel = 0
            };

            resizedTexture2D.ReadPixels(new Rect(0, 0, newWidth, newHeight), 0, 0);
            resizedTexture2D.Apply();
            RenderTexture.active = null;

            var frame = new GifFrame
            {
                Width  = resizedTexture2D.width,
                Height = resizedTexture2D.height,
                Data   = resizedTexture2D.GetPixels32()
            };

            resizedRenderTexture.Release();
            Object.Destroy(resizedTexture2D);

            StoredFrames.Enqueue(frame);
        }