Ask Your Question

cv2.imread() cannot read gifs

asked 2015-10-02 19:19:01 -0500

hekevintran gravatar image

I installed OpenCV 3 using Homebrew and linked it to my Python installation. I'm following through this basic tutorial: https://opencv-python-tutroals.readth...

I'm having trouble with the first code snippet that reads an image:

import numpy as np
import cv2

# Load an color image in grayscale
img = cv2.imread('messi5.jpg',0)

I can run the code above fine if the image is a jpeg or a png, but not if it is a gif.

How do I get cv2.imread() to work on gifs?

edit retag flag offensive close merge delete


"How do I get cv2.imread() to work on gifs?" - unfortunately, no way. there is just no support for gif

(it's still a patent/nonfree problem)

berak gravatar imageberak ( 2015-10-03 00:30:36 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2017-01-20 08:36:44 -0500

egorpugin gravatar image

Hi, Could you please provide more info on this? Wiki says gif's free since 2004 or so. Other imaging libs are actively using gif. The license seems to be permissive. See

edit flag offensive delete link more

Question Tools



Asked: 2015-10-02 19:19:01 -0500

Seen: 7,574 times

Last updated: Oct 02 '15