Ask Your Question
1

cv2.imread() cannot read gifs

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

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

Comments

"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 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

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

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 https://sourceforge.net/p/giflib/code...

edit flag offensive delete link more

Question Tools

2 followers

Stats

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

Seen: 9,675 times

Last updated: Oct 02 '15