import org.codehaus.groovy.scriptom.*
Scriptom.inApartment
{
 im  = new ActiveXObject("ImageMagickObject.MagickImage.1")
 fn = 0
 fnames = []
 for(ct in 3..0){
   25.times {
     fnames << "img${fn.toString().padLeft(3, "0")}.jpg"
     im.convert("-size", "200x200", "xc:white", "-font", "Tahoma",
     "-gravity", "center", "-pointsize", "120",
     "-fill", "black", "-annotate", "0", ct.toString(),
     fnames[fn])
     fn++
   }
 }
 im.convert("img*.jpg", "sample1080a.mpeg")
 for(ct in fn-1..0){
   new File(fnames[ct]).delete()
 }
}
出力動画(sample1080a.mpeg)
動作環境
Groovy1.6.0, JDK1.6 Update12, ImageMagick6.5.0, Microsoft VC++ 2008 Redistributable
※ImageMagickインストール時にCOMインターフェイスも入れておくこと。
 
No comments:
Post a Comment