The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

Type: Package
Title: Convert Png Files into Animated Png
Version: 1.1
Date: 2021-01-12
Author: Quinten Stokkink
Maintainer: Quinten Stokkink <q.a.stokkink@tudelft.nl>
Depends: bitops
Description: 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.
License: GPL-3 | file LICENSE
NeedsCompilation: no
Packaged: 2021-01-12 20:57:30 UTC; quinten
Repository: CRAN
Date/Publication: 2021-01-13 10:50:28 UTC

Convert Png Files into Animated Png

Description

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.

Note

The CRC implementation in this package was adopted from the W3 Portable Network Graphics (PNG) Specification (Second Edition): Annex D - Sample Cyclic Redundancy Code implementation. As such, special thanks go out to the authors of the specification: https://www.w3.org/TR/PNG/#F-Relationship.

Author(s)

Quinten Stokkink

Maintainer: Quinten Stokkink <q.a.stokkink@tudelft.nl>

References

https://www.w3.org/TR/PNG/
https://wiki.mozilla.org/APNG_Specification


Blend previous frame into alpha

Description

When rendering a new frame, the previous frame is filled into the alpha of the new frame. For example, 50% red over blue makes purple.

Value

1


Completely replace the previous frame

Description

When rendering a new frame, the region is filled as specified exactly by the new frame. For example, 50% red over blue makes 50% red over the background.

Value

0


Prepare region as fully transparent

Description

Before a new frame is rendered, the region is replaced by the background color.

Value

1


Write over the current output buffer

Description

Nothing is done to the existing buffer when a new frame is rendered.

Value

0


Keep previous frame in rendering region

Description

Before a new frame is rendered, the region is restored to what it was before the previous frame.

Value

2


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)

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.