question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I can’t seem to figure out how to read/write 30+ FP GIF’s with the “GIF-FI” format.

If I do: imageio.mimwrite("test.gif", images, format="GIF-FI", fps=29)

Followed by: frame_duration_ms = imageio.get_reader("test.gif", format="GIF-FI").get_next_data().meta.ANIMATION.FrameTime

Then frame_duration_ms is 30, but I expect it to be 34 (1000 / 29 == 34.4).

I’ve done some data collection, and writing/reading generally comes out correct…sometimes:

  • write 1 / read 1
  • write 10 / read 10
  • write 15 / read 16.666666
  • write 25 / read 25
  • write 30 / read 33.333333
  • write 40 / read 50
  • write 50 / read 50
  • write 60 / read 100
  • write 100 / read 100

The in -> out is an odd pattern… it seems like there’s an inappropriate truncation/division happening somewhere?

I’ve poked around the codebase a bit, and as far as imageio/plugins/_freeimage.py(759)set_meta_data(), the frametime is correct:

> /Users/joe/repos/third-party/imageio/imageio/plugins/_freeimage.py(759)set_meta_data()
    758                         # Set properties
--> 759                         import ipdb; ipdb.set_trace()  # XXX BREAKPOINT
    760                         lib.FreeImage_SetTagKey(tag, tag_name.encode('utf-8'))

ipdb> tag_name
'FrameTime'
ipdb> tag_val
array([34], dtype=uint32)
ipdb>

At the point the bytes are read from lib.FreeImage, the value is already wrong:

> /Users/joe/repos/third-party/imageio/imageio/plugins/_freeimage.py(692)get_meta_data()
    691                         import ipdb; ipdb.set_trace()  # XXX BREAKPOINT
--> 692                         subdict = metadata.setdefault(model_name, Dict())
    693                         subdict[tag_name] = tag_val

ipdb> tag_val
30
ipdb>

Am I doing something wrong, or is there a bug in the GIF reading/writing code?

Using:

  • imageio: v0.5.1-658-g5d323c0 from this repo
  • FreeImage: 3.17.0 from brew
  • OS: OSX 10.11.6

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
toejoughcommented, May 23, 2017

also, this module is sweet - thank you for building it and making it available!

1reaction
almarkleincommented, Apr 18, 2017

Hehe, after looking into what’s wrong with both the Pillow and FI animated gif modules, I found that its a limitation of GIF itself; the “delay time”, in GIF’s terminology is expressed in hundredths of seconds. See e.g. https://en.wikipedia.org/wiki/GIF (search for “delay”), or https://github.com/imageio/imageio/blob/master/imageio/plugins/pillowmulti.py#L288.

I will add a note to the docs 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

30-fps GIFs - Get the best GIF on GIPHY
Explore and share the best 30-fps GIFs and most popular animated GIFs here on GIPHY. Find Funny GIFs, Cute GIFs, Reaction GIFs and...
Read more >
30fps GIFs - Get the best gif on GIFER
The best GIFs of 30fps on the GIFER website. We regularly add new GIF animations about and . You can choose the most...
Read more >
GIF Converter - GIF, MP4, WEBP, APNG - RedKetchup
Convert an animation or a video to the GIF, MP4, WEBP, or APNG format online. Make an animation from any ... Capture the...
Read more >
30fps GIF - 30FPS - Discover & Share GIFs - Tenor
The perfect 30FPS Animated GIF for your conversation. Discover and Share the best GIFs on Tenor.
Read more >
Best 30 Fps Vs 60 Fps GIFs - Gfycat
30fps vs 60fps GIFs. 294,674 results. Looking for 30fps vs 60fps stickers? The best GIFs for 30fps vs 60fps. Share a GIF and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found