private CloseableReference<Bitmap> createPreviewBitmap(
      AnimatedImage image, Bitmap.Config bitmapConfig, int frameForPreview) {
    CloseableReference<Bitmap> bitmap =
        createBitmap(image.getWidth(), image.getHeight(), bitmapConfig);
    AnimatedImageResult tempResult = AnimatedImageResult.forAnimatedImage(image);
    AnimatedDrawableBackend drawableBackend =
        mAnimatedDrawableBackendProvider.get(tempResult, null);
    AnimatedImageCompositor animatedImageCompositor =
        new AnimatedImageCompositor(
            drawableBackend,
            mIsNewRenderImplementation,
            new AnimatedImageCompositor.Callback() {
              @Override
              public void onIntermediateResult(int frameNumber, Bitmap bitmap) {
                // Don't care.
              }

              @Override
              public @Nullable CloseableReference<Bitmap> getCachedBitmap(int frameNumber) {
                return null;
              }
            });
    animatedImageCompositor.renderFrame(frameForPreview, bitmap.get());
    return bitmap;
  }
Decode a WebP into a CloseableImage.

@param encodedImage encoded image (native byte array holding the encoded bytes and meta data)
@param options the options for the decode
@param bitmapConfig the Bitmap.Config used to generate the output bitmaps
@return a {@link CloseableImage} for the WebP image
animated-base/src/main/java/com/facebook/imagepipeline/animated/factory/AnimatedImageFactoryImpl.java