title: Resizing TGifimage
body: <p>I am trying to resize <code>TGifimage</code> animation using the following procedure. 
  I can resize without no issues, but the quality of the animated gif is very bad.</p>
  
  <p>Any idea how to enhance the quality?</p>
  
  <p>Currently the animated gifs comes out black and looks corrupted. </p>
  
  <pre><code>procedure ResizeGif(Src, Dst: TGifImage; const newHeight, newWidth: integer);
  var
    bmp, bmp2: TBitmap;
    gifren: TGIFRenderer;
    I: integer;
  
  begin
    if (Src.Empty) or not assigned(Src.Images[0]) then
    begin
      exit;
    end;
  
    bmp := TBitmap.Create;
    bmp2 := TBitmap.Create;
    gifren := TGIFRenderer.Create(Src);
  
    try
      bmp.PixelFormat := pf24bit;
      bmp2.PixelFormat := pf24bit;
      bmp.Width := newWidth;
      bmp.Height := newHeight;
  
      for I := 0 to Src.Images.Count - 1 do
      begin
  
        bmp.SetSize(newWidth, newHeight);
  
        gifren.Draw(bmp.Canvas, bmp.Canvas.ClipRect);
  
        bmp2.SetSize(newWidth, newHeight);
  
        bmp2.Canvas.StretchDraw(Rect(0, 0, newWidth, newHeight), bmp);
  
        TGIFGraphicControlExtension.Create(Dst.add(bmp2)).Delay :=
          gifren.FrameDelay div 10;;
  
        gifren.NextFrame;
  
      end;
  
      TGIFAppExtNSLoop.Create(Dst.Images.Frames[0]).Loops := 0;
  
    finally
      bmp.free;
      bmp2.free;
      gifren.free;
    end;
  
  end;
  </code></pre>