Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rendering split animations hangs #454

Open
py9mrg opened this issue Jan 18, 2022 · 1 comment
Open

Rendering split animations hangs #454

py9mrg opened this issue Jan 18, 2022 · 1 comment
Labels

Comments

@py9mrg
Copy link

py9mrg commented Jan 18, 2022

Hello,

I am using split_animation to split an animation up and I've noticed that anim_save or even just printing seem to hang when not using default options. I've even left it overnight and it never finished.

Using all the default settings works fine:

library(tidyverse)
library(gganimate)

data <- tibble(
  x = rep(1:100, 3),
  y = 1:300,
  category = c(rep("A", 100), rep("B", 100), rep("C", 100))
)

p <- ggplot(data, aes(x, y, colour = category)) +
  geom_point(size = 12) +
  transition_reveal(x, keep_last = FALSE)

anim_reveal <- animate(p,
                       renderer = gifski_renderer(loop = FALSE))

split_anim <- split_animation(anim_reveal, by = frame_along < 50)

anim_save("~/split1.gif", split_anim$`FALSE`)

However, if I now change some rendering options to make it a little more taxing then it never finishes.

# initial rendering is fine (as is saving the whole animation with anim_save)
anim_reveal <- animate(p, width = 2888, height = 2166, units = "px",
                       renderer = gifski_renderer(loop = FALSE))

# splitting works ok, if slow
split_anim <- split_animation(anim_reveal, by = frame_along < 50)

# but trying to save or print the split animation will cause a hang
# don't run these lines or you will need to force interrupt R for either of them
# anim_save("~/split2.gif", split_anim$`FALSE`)
# split_anim$`FALSE`

If I do the same as above but do the splitting manually and then render/save using gifski directly it works fine again (and the splitting is much faster):

split_anim <- frame_vars(anim_reveal)[frame_vars(anim_reveal)$frame_along < 50,]$frame_source

gifski::gifski(split_anim, "~/split3.gif", width = 2888, height = 2166, delay = 1/10, loop = FALSE)

Not sure what's happening sorry, but thought I better raise an issue.

@thomasp85 thomasp85 added the bug label Aug 30, 2023
@thomasp85
Copy link
Owner

This seems to be an issue with magick/ImageMagick when handling larger gif files.

Currently magick is used for splitting, but I may have to revisit that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants