How to Read animated gif Perfectly
55 views (last 30 days)
Show older comments
when i use the code like [imgs,map]=imread('xx.gif','frames','all'); and then show it with imshow(imgs(:,:,:,1),map); there are stains on the frame of the gif, I think it may because the GIF disposalMethod is leaveinplace.
How to deal with it? thx
8 Comments
DGM
on 5 Aug 2021
Edited: DGM
on 6 Aug 2021
Unless you are having issues reading the exact same image, please explain your exact issues. There are common and easily-made mistakes that many users make when first trying to read animated gifs, but there are also various bugs which have affected the process throughout different versions, up to and including R2018b-R2020b (idk about R2021a/b). If you are trying to read a complicated color gif, the chances that you're running into one of these problems is high.
This thread explains the most recent issue in depth and also describes common mistakes with colormap handling and offers examples of typical usage for reading gifs prior to R2018b.
If you are running into problems due to that bug, we may have to discuss what workarounds are possible.
EDIT: Preliminary testing with R2021a via the online version suggests that there may be even more egregious bugs now. I don't know if that's just the online version or not. If it affects regular installations, then imread() may simply no longer be able to correctly read GIF files. If you're using R2021a/b, then we'll have to verify that first.
It would be best if you can describe the exact problems you're having, and what version you're using. If possible, you may attach a copy of a test gif and I can see what I can do.
Answers (0)
See Also
Categories
Find more on Import, Export, and Conversion in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!