Skip to content

feat: add GIF support to ImageConverter#2213

Open
UditDewan wants to merge 1 commit into
microsoft:mainfrom
UditDewan:add-gif-image-support
Open

feat: add GIF support to ImageConverter#2213
UditDewan wants to merge 1 commit into
microsoft:mainfrom
UditDewan:add-gif-image-support

Conversation

@UditDewan

Copy link
Copy Markdown

Summary

Fixes #1103

ImageConverter rejected GIF files with UnsupportedFormatException, even though exiftool (used for metadata extraction) and multimodal LLM APIs both handle GIFs. As noted by @afourney in the issue, there's no reason not to support them.

Changes

  • Add image/gif to ACCEPTED_MIME_TYPE_PREFIXES and .gif to ACCEPTED_FILE_EXTENSIONS in _image_converter.py. The existing metadata and LLM-captioning code paths work unchanged: mimetypes.guess_type already resolves .gif correctly, so the data URI sent to the LLM gets the proper image/gif content type.
  • Add tests/test_files/test.gif (a 43-byte 1x1 GIF) and test_markitdown_gif_image in test_module_misc.py, which verifies a GIF converts without raising and that the image is sent to the LLM client as a data:image/gif;base64, URI.

Testing

  • New test passes, along with the full test_module_misc.py and test_module_vectors.py local-file suites.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GIF images cause markitdown.UnsupportedFormatException

1 participant