@Override
    public CloseableImage decode(
        EncodedImage encodedImage,
        int length,
        QualityInfo qualityInfo,
        ImageDecodeOptions options) {
      InputStream encodedInputStream = null;
      try {
        encodedInputStream = encodedImage.getInputStream();
        return new CloseableKeyframesImage(KFImageDeserializer.deserialize(encodedInputStream));
      } catch (IOException e) {
        e.printStackTrace();
        return null;
      } finally {
        Closeables.closeQuietly(encodedInputStream);
      }
    }
Although keyframe files do not have an explicit header, we try to match by looking for a JSON
file start and known mandatory keys.
samples/showcase/src/main/java/com/facebook/fresco/samples/showcase/imageformat/keyframes/KeyframesDecoderExample.java