Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

cv2.imread() cannot read gifs

I installed OpenCV 3 using Homebrew and linked it to my Python installation. I'm following through this basic tutorial: https://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_gui/py_image_display/py_image_display.html

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?