Woah, lot of strange things/misconceptions above... First, there is no JavaScript in the link you mention... But at least indeed, that's the code you need to lower the quality of your Jpeg image.
Now, I thought you wanted to keep all the intermediary images to do some effect, compare each step, or something like that. But with 10K iterations, that's a lot to keep. And, no, using different file names isn't useful.
"
Processing didn't seem to like adding strings to variables to renumber files sequentially."
Wrong, there is no problem with that, but you don't tell us what went wrong in your experiment.
Side note: what is this loop(); in your code above?
Anyway, I think you over-complicated your experiment...
Here is a simpler one:
- PImage original;
- final String PATH = "H:/Temp/Test.jpg";
-
- void setup()
- {
- size(1024, 768);
-
- original = loadImage("H:/PhiLhoSoft/images/foret_0003_1024.jpg");
- original.save(PATH);
- }
-
- void draw()
- {
- PImage test = loadImage(PATH);
- image(test, 0, 0);
- text(frameCount, 10, 30);
- test.save(PATH);
- }
I used absolute paths because I haven't saved the sketch, so the save location is in temporary files.
After 600 iterations, I don't see a very visible degradation, perhaps we need more, or as you did, to compare the files by differencing them in an image editor.
I suppose Jpeg images are saved with relatively high quality, so indeed you might need the code you saw to reduce the quality and see more pronounced artifacts.