(Answering last reply to Chrisir, this Comment thingy is impractical...)
No need for an array for your task, not even for saveFrame(): you just need a global counter, to be used in save(). img.save("bla-" + nf(counter, 3) + ".jpg"); and reload as: img = loadImage("bla-" + nf(counter, 3) + ".jpg"); a counter++ and you can repeat the process. Your experiment could be more effective if we could control the Jpeg quality but Processing doesn't allow this directly.
if you're interested - but frankly calling JS at this point is too tricky for me to contemplate.
I'm hoping that continually opening and saving the same jpeg will actually recursively gradually compress an image to big blocks it may take 10k iterations or more but I'm interested to see what happens.
I've checked for differences in file 000 and file 200 by overlaying and blending with difference in PShop - doesn't look like my idea will generate any results - looks like I'll have to mug up on how to call in that JS routine :-/
will have a head scratch and see if I can unpick the JS routine or have a look at a Lib - but I have a feeling that I may have hit a dea end. I don't want to force the compression too much - I'm testing a hypothesis that every time a jpeg is renamed it under goes some kind of recompression when saved - I may have to throw out the hypothesis.
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:
final String PATH = "H:/Temp/Test.jpg";
original = loadImage("H:/PhiLhoSoft/images/foret_0003_1024.jpg");
PImage test = loadImage(PATH);
image(test, 0, 0);
text(frameCount, 10, 30);
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.
Leave a comment on PhiLho's reply
Change topic type
Link this topic
Provide the permalink of a topic that is related to this topic