apng {apng}R Documentation

Convert static pngs to animated png

Description

Combine multiple png files into an animated png file.

Usage

apng(input_files = c(), output_file = "output.png",
num_plays = 0, delay_num = 0, delay_den = 0,
dispose_op = APNG_DISPOSE_OP_NONE,
blend_op = APNG_BLEND_OP_SOURCE)

Arguments

input_files

to specify the names of the input files

output_file

the name of the output file

num_plays

the amount of times to repeat the animation (0 means forever)

delay_num

the numerator of the frame delay (delay = \frac{delay\_num}{delay\_den})

delay_den

the denominator of the frame delay (delay = \frac{delay\_num}{delay\_den})

dispose_op

the frame disposal strategy
(APNG_DISPOSE_OP_NONE, APNG_DISPOSE_OP_BACKGROUND,
APNG_DISPOSE_OP_PREVIOUS)

blend_op

the frame blending strategy
(APNG_BLEND_OP_SOURCE, APNG_BLEND_OP_OVER)

For more information on blending and frame disposal strategies see https://wiki.mozilla.org/APNG_Specification.

Value

Returns nothing, output is written to output_file.

Examples

input1 <- tempfile(pattern = "", fileext = ".png")
input2 <- tempfile(pattern = "", fileext = ".png")
output <- tempfile(pattern = "", fileext = ".png")

# Generate inputs.
png(filename=input1)
plot(1:40, (1:40)^2)
dev.off()
png(filename=input2)
plot(1:40, (-1*1:40)^3)
dev.off()

# Create an animated png.
apng(c(input1, input2), output)

[Package apng version 1.1 Index]