@Override
    public ImageMetadata getMetadata(final ByteSource byteSource, final GifImagingParameters params) throws ImagingException, IOException {
        final GifImageContents imageContents = readFile(byteSource, GifImagingParameters.getStopReadingBeforeImageData(params));

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

        final List<GifImageData> imageData = findAllImageData(imageContents);
        final List<GifImageMetadataItem> metadataItems = Allocator.arrayList(imageData.size());
        for (final GifImageData id : imageData) {
            final DisposalMethod disposalMethod = createDisposalMethodFromIntValue(id.gce.dispose);
            metadataItems.add(new GifImageMetadataItem(id.gce.delay, id.descriptor.imageLeftPosition, id.descriptor.imageTopPosition, disposalMethod));
        }
        return new GifImageMetadata(bhi.logicalScreenWidth, bhi.logicalScreenHeight, metadataItems);
    }
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