Collating .tif images?


#1

I have a script I’m using to capture frames(I made it simpler for understandability’s sake here, so I can’t change it, sorry :frowning: ). I’ve used the processing moviemaker tool in the past, but is there any way to use it as a library rather than a tool to collate the images in a directory to a quicktime format? Is there a better method that would save mp4(that’s what I’m looking for)?

import java.awt.AWTException;
import java.awt.Robot;
import java.awt.Rectangle;
scap video;
Robot robot;
int cw=800, ch=600;
void setup() {
  size(800,600);
  try {
    robot = new Robot();
  }
  catch (AWTException err) {
    println(err);
  }
  video = new scap();
}
void draw() {
  PImage vi= video.get();
  image(vi, 0, 0, width, height);
}
class scap {
  PImage screenshot;
  PImage get() {
    screenshot = new PImage(robot.createScreenCapture(new Rectangle(0, 0, cw, ch)));
    return screenshot;
  }
}

EDIT: Forgot to add, the images save to the same dir as the pde file, I neglected to actually put saveframe in here because it was part of another function (oh well…)


#2

I don’t know of any library that converts straight to MP4. But, as an automatable alternative, you could save all of your images into a folder, and then tell Processing to launch an external executable like ffmpeg and direct it to the folder that contains your images.
What operating system are you on?


#3

windows 10, but would prefer something that dosen’t require an external program(I’d be willing to export in a different format if it means I could keep it internal)


#4

Oh.
I suggest searching on the internet for Java libraries that convert to MP4. Then, you can import it as a library into Processing and probably do the thing, cross-platform.
Also, since PImage is a format of Processing, without some work such libraries would need you to save your images into files though, and then convert the folder to .mp4.

Good luck!