Closed BillWeld closed 8 years ago
Hi,
I removed the extra quote in function gm.convert()
.
Could you please help us test if the new version of gm.convert()
would generate GIF images successfully on your computer?
The new function is tested under Fedora and Windows, it can generate animated GIF images successfully.
Here is the test script.
install.packages("devtools")
library(devtools)
dev_mode(on=T)
install_github("animation",username="yulijia ",ref="issue71")
library(animation)
## generate gif
owd = setwd(tempdir())
oopt = ani.options(interval = 0.05, nmax = 20)
png("bm%03d.png")
brownian.motion(pch = 21, cex = 5, col = "red", bg = "yellow",
main = "Demonstration of Brownian Motion")
dev.off()
## use ImageMagick
im.convert("bm*.png", output = "bm-withoutQuotes1.gif")
## use GraphicsMagick
gm.convert("bm*.png", output = "bm-withoutQuotes2.gif")
# when finished do:
dev_mode(on=F)
It works! Or it works once I remove the extra space in “yulikia “ :)
Here’s what I was working on, which you are welcome to use as an example if you like:
Thanks! Rob
On Dec 5, 2015, at 3:34 AM, Lijia Yu notifications@github.com wrote:
Hi, I removed the extra quote in function gm.convert(). Could you please help us test if the new version of gm.convert() would generate GIF images successfully on your computer? The new function is tested under Fedora and Windows, it can generate animated GIF images successfully.
Here is the test script.
install.packages("devtools") library(devtools)
dev_mode(on=T)
install_github("animation",username="yulijia ",ref="issue71")
library(animation)
generate gif
owd = setwd(tempdir()) oopt = ani.options(interval = 0.05, nmax = 20) png("bm%03d.png") brownian.motion(pch = 21, cex = 5, col = "red", bg = "yellow", main = "Demonstration of Brownian Motion") dev.off()
use ImageMagick
im.convert("bm*.png", output = "bm-withoutQuotes1.gif")
use GraphicsMagick
gm.convert("bm*.png", output = "bm-withoutQuotes2.gif")
when finished do:
dev_mode(on=F) — Reply to this email directly or view it on GitHub https://github.com/yihui/animation/issues/71#issuecomment-162161323.
Hi Rob,
Beautiful Lissajous curve!
If you would like provide an example of how to generate this figure, we're happy to help you add this example to animation
package as a animation demo.
Just fork this package, prepare and submit a pull request.
BTW, You can use the new gm.convert()
via install the development version of this package.
Here is the code.
install.packages('animation', repos = 'http://yihui.name/xran')
Thanks. I’m afraid I don’t have the patience to learn everything I would need to know to integrate my code into an R package. Feel free to do it yourself though if you like. Here it is:
Rob
On Dec 5, 2015, at 9:27 PM, Lijia Yu notifications@github.com wrote:
Hi Rob, Beautiful Lissajous curve! If you would like provide an example of how to generate this figure, we're happy to help you add this example to animation package as a animation demo https://github.com/yihui/animation/tree/master/demo. Just fork this package, prepare and submit a pull request.
BTW, You can use the new gm.convert() via install the development version of this package.
Here is the code.
install.packages('animation', repos = 'http://yihui.name/xran') — Reply to this email directly or view it on GitHub https://github.com/yihui/animation/issues/71#issuecomment-162264419.
Github issues does not support attachments if you reply by email. You can either paste the code here, or send to us directly by email (xie <at> yihui.name
or yulj2010 <at> gmail.com
). Thanks!
On Dec 7, 2015, at 11:30 PM, Yihui Xie notifications@github.com wrote:
Github issues does not support attachments if you reply by email. You can either paste the code here, or send to us directly by email (xie
yihui.name or yulj2010 gmail.com). Thanks! — Reply to this email directly or view it on GitHub https://github.com/yihui/animation/issues/71#issuecomment-162759780.
library(animation)
plot.lissajous <- function(omega.x, omega.y, delta = 0, num.thetas = 200, ...) { thetas <- seq(from = 0, to = 2 * pi, length.out = num.thetas) xs <- sin(omega.x * thetas + delta) ys <- cos(omega.y * thetas) plot(x = xs, y = ys, type = "l", ann = FALSE, axes = FALSE, ...) }
create.lissajous.gif <- function(gif.name = "lissajous.gif", frames.per.second = 24, loop.length = 3, ## in seconds max.degree = 5, line.width = 3, image.dir = tempdir()) {
num.frames <- round(loop.length \* frames.per.second)
deltas <- head(seq(from = 0, to = 2 \* pi, length.out = num.frames + 1), -1)
image.files <-
sapply(X = seq_len(num.frames), FUN = function(i) {
image.file <- file.path(image.dir, sprintf("img-%04d.png", i))
png(file = image.file)
par(mar = c(1, 1, 1, 1),
mfcol = c(max.degree, max.degree))
for (omega.x in seq_len(max.degree)) {
for (omega.y in seq_len(max.degree)) {
plot.lissajous(omega.x = omega.x, omega.y = omega.y, delta = deltas[i], lwd = line.width)
}
}
dev.off()
return(image.file)
})
## Combine the individual image files into an animated GIF file.
oopt <- ani.options(interval = 1 / frames.per.second,
loop = TRUE,
autobrowse = FALSE)
gm.convert(files = file.path(image.dir, "*"), output = gif.name)
## Restore animation options.
ani.options(oopt)
}
create.lissajous.gif()
The gm command works fine in a shell with the quotes removed.