@Override
    public BufferedImage getBufferedImage(final ByteSource byteSource, final GifImagingParameters params) throws ImagingException, IOException {
        final GifImageContents imageContents = readFile(byteSource, false);

        final GifHeaderInfo ghi = imageContents.gifHeaderInfo;
        if (ghi == null) {
            throw new ImagingException("GIF: Couldn't read Header");
        }

        final GifImageData imageData = findFirstImageData(imageContents);

        return getBufferedImage(imageData, imageContents.globalColorTable);
    }
See {@link GifImageParser#readBlocks} for reference how the blocks are created. They should match the code we are giving here, returning the correct
class type. Internal only.
src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java