OpenCV GIF support?

Hi all,

I recently noticed that there is no GIF support in OpenCV’s imread function. According to several answers I found online, the reason for this is that there were patents that required a license to implement a GIF codec, even for open source software. Furthermore, GIF reading is possible using FFmpeg, which however requires FFmpeg support for OpenCV (which might not be available for different reasons). At least reading GIF files with FFmpeg works, still I’m curious why there is no native GIF codec inside OpenCV.

To the best of my knowledge, all patents protecting the GIF codec are expired for ages. So at least in theory, native GIF support could be implemented in OpenCV. Nowadays OpenCV is one of the biggest if not even the leading open source image processing library, but it still has no native GIF support. Are there any plans to change this? Or might there be even plans that GIF will never be supported natively? Is GIF simply too irrelevant nowadays and OpenCV does not want to support it besides indirectly by using FFmpeg? Or maybe just no developer time should be spent on such an old and rarely used format?

use VideoCapture to read GIF files, animated or not.

VideoCapture’s CAP_IMAGES can also handle any other image formats. it would represent a single image as a one-frame “video”. CAP_IMAGES was originally intended for sequences of images.

1 Like

ah, you’re asking for native GIF and are aware of VideoCapture with ffmpeg doing the job already. I only skimmed your first post.

well… nobody needs it. opencv with ffmpeg is available on basically every platform.

also, GIF is such an ancient format, nobody should still be using it, and everything “animated” these days is either an actual video file, or whatever goes on inside of a “MNG” (motion PNG) file.

if you can’t have ffmpeg for some reason, just look for a gif library and use it in your application.

Thanks for your answer! So basically my interpretation was correct I think. Native GIF support could be added, but currently there are no plans to do so. It is rarely used in either case and if GIF support is required, it is provided by FFmpeg.