public static WebPImage createFromByteArray(byte[] source, @Nullable ImageDecodeOptions options) {
    ensure();
    Preconditions.checkNotNull(source);

    ByteBuffer byteBuffer = ByteBuffer.allocateDirect(source.length);
    byteBuffer.put(source);
    byteBuffer.rewind();

    WebPImage image = nativeCreateFromDirectByteBuffer(byteBuffer);
    if (options != null) {
      image.mDecodeBitmapConfig = options.animatedBitmapConfig;
    }
    return image;
  }
Creates a {@link WebPImage} from the specified encoded data. This will throw if it fails to
create. This is meant to be called on a worker thread.

@param source the data to the image (a copy will be made)
animated-webp/src/main/java/com/facebook/animated/webp/WebPImage.java