r-rust / gifski

R wrapper for the 'gifski' Rust Cargo crate.
Other
73 stars 4 forks source link

Inconsistent fill color (sprinkles, patterns) with gganimate #20

Closed schnodo closed 2 years ago

schnodo commented 2 years ago

I'm using gifski 1.4.3-1 on Windows 10. When rendering an animation, some bars have patterns or sprinkles in some frames instead of a solid color.

gganimate fill glitch test_page_0009

Here is the code for reproducing the issue:

library(ggplot2)
library(gganimate)
library(gifski)
p <- ggplot(mpg, aes(y = manufacturer, fill = stat(count)))+
  geom_bar()+
  transition_reveal(along = stat(count))

animate(p, renderer = gifski_renderer())

And this is the resulting animation: gifski animation test

jeroen commented 2 years ago

It seems to work fine for me (also created with windows):

preview

Which version of R do you use? Are you using the latest CRAN versions of all the things? Try update.packages(ask=F)

schnodo commented 2 years ago

Thanks for looking into it. I'm running R version 4.1.3 (2022-03-10) -- "One Push-Up". I did as you suggested but the result is similar: the file size has changed a bit from 26 626 bytes to 26 953 and the patterns are slightly different but nothing like your clean render.

Is there anything else I can check/update?

jeroen commented 2 years ago

Can you show your sessionInfo() ?

Also, for testing, could you try with av_renderer() such that maybe we can narrow down if the problem appears in gifski, or elsewhere in the stack?

schnodo commented 2 years ago

Before posting my report, I tried ffmpeg_renderer() and magick_renderer() to make sure that it didn't happen with all renderers. Both looked fine. I checked with av_renderer() now and that looks okay, too.

Here's the output from sessioninfo():

platform       x86_64-w64-mingw32          
arch           x86_64                      
os             mingw32                     
system         x86_64, mingw32             
status                                     
major          4                           
minor          1.3                         
year           2022                        
month          03                          
day            10                          
svn rev        81868                       
language       R                           
version.string R version 4.1.3 (2022-03-10)
nickname       One Push-Up
jeroen commented 2 years ago

Can you also post the package versions part of your sessionInfo() so I can compare them with mine?

schnodo commented 2 years ago

Sorry about that. I used the wrong function. Here you go:

R version 4.1.3 (2022-03-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] av_0.7.0        gifski_1.4.3-1  gganimate_1.0.7 ggplot2_3.3.5  

loaded via a namespace (and not attached):
 [1] progress_1.2.2     tidyselect_1.1.2   xfun_0.30          purrr_0.3.4        sf_1.0-7          
 [6] colorspace_2.0-3   vctrs_0.3.8        generics_0.1.2     htmltools_0.5.2    base64enc_0.1-3   
[11] yaml_2.3.5         utf8_1.2.2         rlang_1.0.2        e1071_1.7-9        pillar_1.7.0      
[16] glue_1.6.2         withr_2.5.0        DBI_1.1.2          tweenr_1.0.2       RColorBrewer_1.1-2
[21] lifecycle_1.0.1    plyr_1.8.7         munsell_0.5.0      gtable_0.3.0       evaluate_0.15     
[26] labeling_0.4.2     knitr_1.38         forcats_0.5.1      fastmap_1.1.0      class_7.3-20      
[31] fansi_1.0.3        Rcpp_1.0.8.3       KernSmooth_2.23-20 scales_1.1.1       classInt_0.4-3    
[36] farver_2.1.0       hms_1.1.1          digest_0.6.29      stringi_1.7.6      dplyr_1.0.8       
[41] grid_4.1.3         cli_3.2.0          tools_4.1.3        magrittr_2.0.2     maps_3.4.0        
[46] proxy_0.4-26       tibble_3.1.6       crayon_1.5.1       tidyr_1.2.0        pkgconfig_2.0.3   
[51] ellipsis_0.3.2     prettyunits_1.1.1  rmarkdown_2.13     rstudioapi_0.13    R6_2.5.1          
[56] units_0.8-0        compiler_4.1.3    
jeroen commented 2 years ago

OK I have no idea where this came from, but I think it is gone in the new version. Can try with gifski 1.6.6?

install.packages("gifski", repos = 'https://r-rust.r-universe.dev')
schnodo commented 2 years ago

Excellent! Also the file is now smaller, only 17 137 bytes. Kind of expectable but I hadn't anticipated it. 😊

Thank you for taking care of the issue!

jeroen commented 2 years ago

OK thanks, I have no submitted it to CRAN for release.