@@ -1445,20 +1445,28 @@ invisible(
14451445imgs <-
14461446 list.files(stringr::str_remove(here::here("Paper 2/animation"), "cropDiffusionR/"),
14471447 full.names = TRUE)
1448- img_list <- lapply(imgs, magick::image_read)
14491448
1450- # join the images together
1451- img_joined <- magick::image_join(img_list)
1452-
1453- # animate at 4 frames per second
1454- img_animated <- magick::image_animate(img_joined, fps = 1)
1455-
1456- # save to disk
1457- magick::image_write(image = img_animated,
1458- path = stringr::str_remove(
1449+ #Here, we use gifski, as it is a lot quicker than magick.
1450+ gifski(imgs, gif_file = stringr::str_remove(
14591451 here::here("Paper 2/animation/maize_anomaly_plots_arranged.gif"),
14601452 "cropDiffusionR/"
1461- ))
1453+ ), width = 1117, height = 952, delay = 1)
1454+
1455+ # For using magick to create gif.
1456+ # img_list <- lapply(imgs, magick::image_read)
1457+ #
1458+ # # join the images together
1459+ # img_joined <- magick::image_join(img_list)
1460+ #
1461+ # # animate at 4 frames per second
1462+ # img_animated <- magick::image_animate(img_joined, fps = 1)
1463+ #
1464+ # # save to disk
1465+ # magick::image_write(image = img_animated,
1466+ # path = stringr::str_remove(
1467+ # here::here("Paper 2/animation/maize_anomaly_plots_arranged.gif"),
1468+ # "cropDiffusionR/"
1469+ # ))
14621470
14631471```
14641472
0 commit comments