I am trying to create an animated GIF file from a set of PNG files 
created from number realization.  Itried with animation ( depend -  
ImageMagick) and caTools packages, but I did not successful to make the 
GIS file.  Is  there any way to do this?
Thanks
Zia

# GIF animation

library(sp)
library(gstat)
library(lattice)
library(RColorBrewer)
library(maptools)
library(maps)
library(ggplot2)
library(lubridate)
library(animation)
library(fields) # for tim.colors
library(caTools) # for write.gif
library(raster)

data(meuse)
data(meuse.grid)
coordinates(meuse) <- ~x+y
coordinates(meuse.grid) <- ~x+y
gridded(meuse.grid) <- TRUE

lzn.vgm <- variogram(log(zinc)~1, meuse)
lzn.fit <- fit.variogram(lzn.vgm, model = vgm(1, "Sph", 900, 1))

ns=4

sim_ns = krige(log(zinc)~1, meuse, meuse.grid, model = lzn.fit,
nmax = 30, nsim = ns)

# Save figures as PNG files

rgb.palette <- colorRampPalette(c("lightyellow","green","orange","brown"),
space = "rgb")

setwd("C:/sim")

for (i in 1:ns){
png(filename = paste("sim",i,".png",sep=""), width=400, height=500, 
units="px",
pointsize=12, bg="transparent", res=NA)
print(spplot(sim_ns[,i], main = list(label=paste("SIS",i),cex=1.5),
par.settings=list(axis.line=list(col=NA)),
col.regions=rgb.palette(22)))
dev.off()
}

# Creat a gif.file
system("convert -delay 40 *.png sim.gif") # 
Source(http://ryouready.wordpress.com/2010/11/21/animate-gif-images-in-r-imagemagick/)
Invalid Parameter - 40
Warning message:
running command 'convert -delay 40 sim*.png plot.gif', invisible = F, 
wait=T' had status 4



---------------------
Zia Ahmed, PhD
Research Associate
Department of Crop and Soil Sciences
1002 Bradfield Hall, Cornell University
Ithaca, NY 14853-4203
t. 607.255.9387
f. 607.255.3207
email zua3@cornell.edu



	[[alternative HTML version deleted]]

