ben processing kütüphaneleri (GPL) den MovieMaker sınıfla QTJ aracılığıyla yaptık. İşleme, yeni başlayanlar için saklayabilmesine rağmen, saf java'dır.
Küçük öğretici: İndir İşleme, Sketch gidin, açmak -> Show Sketch Klasör, "veri" adlı bir klasör oluşturun ve aracılığıyla, bu klasörün içinde adı "filename01.gif" Tüm görüntüleri koymak " filename09.gif". editör aşağıdaki kodu yapıştırın ve oynattı:
/**
* Makes a QuickTime movie out of an array of images.
*/
import processing.video.*;
MovieMaker mm;
PImage[] imageFrames;
int index;
void setup() {
size(320, 240);
int numFrames = 9;
imageFrames = new PImage[numFrames];
for(int i = 0; i < imageFrames.length; i++)
{
imageFrames[i] = loadImage("filename" + nf(i+1,2) + ".gif");
}
// Save uncompressed, at 15 frames per second
mm = new MovieMaker(this, width, height, "drawing.mov");
// Or, set specific compression and frame rate options
//mm = new MovieMaker(this, width, height, "drawing.mov", 30,
// MovieMaker.ANIMATION, MovieMaker.HIGH);
}
void draw() {
if(index < imageFrames.length)
{
// show the image
image(imageFrames[index], 0, 0);
// Add window's pixels to movie
mm.addFrame();
index++;
}
else
{
mm.finish();
// Quit running the sketch once the file is written
exit();
}
}
Bu kroki klasörde görüntülerden bir dosya "drawing.mov" yaratacaktır. Dosyaya -> ihracat uygulamasına gidip eskiz klasörünü açın ve application.macosx/source veya application.windows/source klasörüne gidin, gerçek kodu olan bir .java dosyası olmalıdır. böyle:
import processing.core.*;
import processing.xml.*;
import processing.video.*;
import java.applet.*;
import java.awt.*;
import java.awt.image.*;
import java.awt.event.*;
import java.io.*;
import java.net.*;
import java.text.*;
import java.util.*;
import java.util.zip.*;
import java.util.regex.*;
public class movie2 extends PApplet {
/**
* Makes a QuickTime movie out of an array of images.
*/
MovieMaker mm;
PImage[] imageFrames;
int index;
public void setup() {
size(320, 240);
int numFrames = 9;
imageFrames = new PImage[numFrames];
for(int i = 0; i < imageFrames.length; i++)
{
imageFrames[i] = loadImage("filename" + nf(i+1,2) + ".gif");
}
// Save uncompressed, at 15 frames per second
mm = new MovieMaker(this, width, height, "drawing.mov");
// Or, set specific compression and frame rate options
//mm = new MovieMaker(this, width, height, "drawing.mov", 30,
// MovieMaker.ANIMATION, MovieMaker.HIGH);
}
public void draw() {
if(index < imageFrames.length)
{
// show the image
image(imageFrames[index], 0, 0);
// Add window's pixels to movie
mm.addFrame();
index++;
}
else
{
mm.finish();
// Quit running the sketch once the file is written
//exit();
println("done");
}
}
static public void main(String args[]) {
PApplet.main(new String[] { "--bgcolor=#e0dfe3", "movie2" });
}
}
saf java kullanmak için, üzerinde sınıf işleme uygulaması klasöründen core.jar ve video.jar kullanmak gerekir ve sonra bu java kodu derlemek gerekir. İşte işlem kitaplığı için bir function reference ve bir javadoc. Here are the javadocs for the MovieMaker class. İsterseniz, MovieMaker sınıfına source'u görebilirsiniz.
HTH