R2SWF (version 0.9-9)

image2swf: Convert bitmap images to SWF

Description

Given the file names of a sequence of images, this function can convert them into a Flash file (.swf). Supported input formats are jpg/jpeg and png. The two formats are allowed to appear in the same sequence.

Usage

image2swf(input, output = "movie.swf", bgColor = "white", interval = 1)

Value

The name of the generated swf file if successful.

Arguments

input

the file names of the images to be converted

output

the name of the output SWF file

bgColor

background color of the output SWF file

interval

the time interval (in seconds) between animation frames

Author

Yixuan Qiu <https://statr.me>

Details

This function uses the Ming library (https://github.com/libming/libming) to implement the conversion. If you want to create a Flash file consisting of vector graphics, use svg2swf() instead.

Examples

Run this code
if(capabilities("png")) {
  olddir = setwd(tempdir())
  png("Rplot%03d.png")
  for(i in 1:9) plot(runif(20), ylim = c(0, 1))
  dev.off()
  output = image2swf(sprintf("Rplot%03d.png", 1:9))
  swf2html(output)
  setwd(olddir)
}

Run the code above in your browser using DataLab