将2张jpg生成GIF的例子:
Code
ImageInfo img1 = new ImageInfo("c:\\1.jpg");
img1.setCompression(75);
ImageInfo img2 = new ImageInfo("c:\\2.jpg");
img2.setCompression(75);
MagickImage[] images = new MagickImage[2];
images[0] = new MagickImage(img1);
images[1] = new MagickImage(img2);
images[0].setDelay(50);//第一帧播放的时间
images[1].setDelay(60);//第二帧播放的时间
MagickImage Animation = new MagickImage(images);
ImageInfo bidon = new ImageInfo();
Animation.setFileName("c:\\photo.gif");
Animation.writeImage(bidon);
ImageInfo img1 = new ImageInfo("c:\\1.jpg");
img1.setCompression(75);
ImageInfo img2 = new ImageInfo("c:\\2.jpg");
img2.setCompression(75);
MagickImage[] images = new MagickImage[2];
images[0] = new MagickImage(img1);
images[1] = new MagickImage(img2);
images[0].setDelay(50);//第一帧播放的时间
images[1].setDelay(60);//第二帧播放的时间
MagickImage Animation = new MagickImage(images);
ImageInfo bidon = new ImageInfo();
Animation.setFileName("c:\\photo.gif");
Animation.writeImage(bidon);