Every once in a while, someone claims that a level-12 JPEG can be saved, opened, saved, etc, many times without loss of quality.
I decided to write a script to test this, not only for level 12 but also level 10 and level 4.
Here is the script:
Code: Select allvar FILE04 = "/tmp/clock-level-04.jpg";
var FILE10 = "/tmp/clock-level-10.jpg";
var FILE12 = "/tmp/clock-level-12.jpg";
var jpeg12Options = new JPEGSaveOptions();
var jpeg10Options = new JPEGSaveOptions();
var jpeg04Options = new JPEGSaveOptions();
jpeg12Options.quality = 12;
jpeg10Options.quality = 10;
jpeg04Options.quality = 4;
function OpenSaveJPEG(f, jpo) {
var fref1 = new File(f);
var fref2 = new File(f);
open(fref1);
var docRef = app.activeDocument;
docRef.saveAs(fref2, jpo);
docRef.close();
fref1 = null;
fref2 = null;
}
var startDisplayDialogs = app.displayDialogs;
app.displayDialogs = DialogModes.NO;
for (i = 0; i < 20; i++) OpenSaveJPEG(FILE04, jpeg04Options);
for (i = 0; i < 20; i++) OpenSaveJPEG(FILE10, jpeg10Options);
for (i = 0; i < 20; i++) OpenSaveJPEG(FILE12, jpeg12Options);
app.displayDialogs = startDisplayDialogs;
Here is the original image:
Here is the result of twenty open & save at quality 4:
Here is the result of twenty open & save at quality 10:
Here is the result of twenty open & save at quality 12:
Now, why does quality 10 look worse than quality 4?
Or is there a bug in my script?
(This test was done in CS3 on a Mac.)