Open caewok opened 3 years ago
Does image_animate(img, optimize = FALSE)
do what you want? Perhaps icw a custom method
parameter? See:
No, image_animate
does not do the trick. Take this koala gif, for example. When I run the following code, it imports the gif, but because the gif was optimized, it does not fill in the subsequent frames with the entire image. So the animation only shows the changing parts of the image:
image_read("koala.gif") %>%
image_animate(delay = .1, optimize = FALSE)
You can also see this when you place the frames side-by-side:
image_read("koala.gif") %>%
image_append()
FYI, setting optimize to TRUE in image_animate
makes no difference. The problem seems to be that image_animate
needs to start with the full set of images, and then optimize can remove unchanging pixels when animating the images. But not the other way round.
I think what you want is image_animate(optimize = FALSE, dispose = 'none')
Yes,image_animate(optimize = FALSE, dispose = 'none')
seems to work. Thanks! I think it would still be worth adding a coalesce option to image_read or convert, because that would be closer to the expected workflow in the command-line version of magic.
Not sure if this is a feature request or a bug.
I would like to be able to coalesce an imported animation. For example,
convert koala.gif -coalesce xx_%05d.png
using the command line creates a set of complete pngs for each point a the animation. Importing the gif in the magick package instead results in subframes, and I don't see a comparable way within magick to get a full set of images from the imported animation.Relatedly, there is an
image_coalesce
function in the package reference, but that function is not actually exported. And when I try to usemagick:::image_coalesce
on an imported gif, I still end up with subframes. So I don't think thatimage_coalesce
function is intended to be used in this manner. Instead, it seems likemagick::image_convert
and/ormagick::image_read
should take a coalesce parameter and modify the imported images accordingly. Thanks!