Convert Png Files into Animated Png

Convert several png files into an animated png file. This package exports only a single function `apng'. Call the apng function with a vector of file names (which should be png files) to convert them to a single animated png file.


Pure R package to create animated png files from png files.

Installing

library(devtools)
install_github("qstokkink/apng")

Using

library(apng)
 
apng(my_vector_of_file_names)

Examples

library(apng)
 
pdf(NULL)
png(filename="1.png", type="cairo-png")
plot(1:40, (1:40)^2)
dev.off()
png(filename="2.png", type="cairo-png")
plot(1:40, (-1*1:40)^3)
dev.off()
apng(c("1.png", "2.png"))

Example output

x <- 1:40
frame_count <- 40
 
for (i in 1:frame_count) {
    png(filename=paste(i, ".png"), type="cairo-png")
    plot(x, sin((i/x)%% 1) * (-1)^x,
        ylim=c(-1,1),
        col = ifelse(x == i, "red", "black"),
        pch = ifelse(x == i, max((-1)^i, 0)*5, ifelse(x > i, 8, 1)))
    dev.off()
}
 
apng(paste(1:frame_count, ".png"))

Example output2

News

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("apng")

1.0 by Quinten Stokkink, 4 years ago


Browse source code at https://github.com/cran/apng


Authors: Quinten Stokkink


Documentation:   PDF Manual  


GPL-3 | file LICENSE license


Depends on bitops


See at CRAN