Posted by mark miller on October 16, 2010 at 11:46 AM
Not seeing this addressed elsewhere, (nor a post on this I thought I already made) I am wondering exactly what kind of work can be done on jpegs without further compression or degradation with "save" and "save as" commmands?
I'd like to re-size a folder of jpegs, perhaps add some file info, and maybe just tweak ever so slightly. I am wondering what I can get away with and avoid any degradation. Of course, the proper way is to work with the original tiffs, and then save the changes as jpegs, and I do this usually.
I did a test on a jpeg file in CS4. I added file info, and then
closed and saved the file under "save as" to another jpeg
with a new name. I opened the new file, and repeated this process several times, noting the compressed and uncompressed file sizes,
The size did not change at all, apparently no loss of information with saving as jpeg, even several times.
So, there's more to this. Any explanations? Maybe I shouldn't be so fearful working in jpegs for minor changes?
In my experience the worst things you can do are to sharpen or rez up jpegs that have been previously save, or especially if saved too many times. I don't worry about any processing on jpegs before the first save, but once they've been saved I won't do any more processing on the file. But because of that, I use Save As rather than Save after that initial processing so that the original is retained. If in the future I have to prepare a new version I always go back to the original and start over.
Posted by mark miller on October 16, 2010 at 12:48 PM
I just repeated the test, this time even more critically. Let's say you've done all the work, all appears fine and wonderful, you save your file as jpeg. (ignoring the fact it's wiser to save a 'master' tiff file), and you notice one spot needs to be cloned away in the sky of your jpeg. But you've already saved it. WHat kind of loss will there be by re-opening in PS, making that one correction, and then re-saving,
I took a section of a jpeg, and duplicated it for comparison. The were both 385K. In one I created an action command which used one clone stamp operation, and then saved that file, and then re-opened that test file, performed that clone operation again, and then re-saved using "save" the changes, and re-opened, cloned and saved, etc. I repeated this action hundred times on the test image. The file size stayed the same from start to finish, plus a 100% I could not discern any changes, or any lossy degradation whatsoever. So I don't know what to make of this.
Posted by mark miller on October 16, 2010 at 1:00 PM
Thanks Hank. My second post must have crossed with your first post. I'm challenging conventional wisdom on what "we are supposed to know" on this subject.
As you can see from my experiment, even with the "Save" command, I could not see any loss, even after 100 repetitions. Like I said, I have a whole folder of images with which I'd simply like to make minor alterations, like add file info, and then simply "save". The other option is for the Alamy guidelines/suggestions, to save jpegs on "baseline" for better apparent quality.
I don't want to start from scratch when perhaps the "save" command on a jpeg with very minor alterations (or something as innocuous as adding file info or down scaling perhaps) will not alter the qualilty anyway, if that be the case.
Posted by David Bostedo on October 16, 2010 at 1:04 PM
Mark - I've found that I can open a re-save a high quality JPG quite a few times before the compression becomes noticeable. In fact, I save my RAW, but don't create TIFFs from them, and save as JPGs instead. I've seen the same as you, opening several times, always saving at the highest quality, and not seeing any degradation that I'd care about.
A couple of notes though - if you're not saving at the highest quality, problems can set in quickly. Also, the JPG algorithm is image dependent, so some images might show issues that others wouldn't even with a few saves.
Finally, don't always trust that the same file size means nothing changed. Especially if you have a color profile, EXIF, or other metadata saved with the file, since it will be constant. You might want to take your original JPG, and your final after 100 saves, and overlay them on layers in PS. Then setting the top layer blend mode to "difference" will show you how much difference is there in detail.
Here are some examples of people doing what you're doing but with different images/compression/programs :
Posted by mark miller on October 16, 2010 at 1:29 PM
David- interesting to look at those links, They all, however, showed examples of compression saves using qualities lower than 100 (or Q 12 in PS), which I noticed too in tests. Yes, jpeg degradation is very noticeable at lower qualities. I also did the overlay as you suggested, blended with "difference" and did not see any evidence whatsoever (ie completely black).
Posted by mark miller on October 16, 2010 at 1:40 PM
David- interesting to look at those links, They all, however, showed examples of compression saves using qualities lower than 100 (or Q 12 in PS), which I noticed too in tests. Yes, jpeg degradation is very noticeable at lower qualities. I also did the overlay as you suggested, blended with "difference" and did not see any evidence whatsoever (ie completely black).
Posted by David Bostedo on October 16, 2010 at 3:58 PM
I also did the overlay as you suggested, blended with "difference" and did not see any evidence whatsoever (ie completely black).
That would tell me that for the image you're using, and the program you're using, the lowest compression JPG algorithm is able to recreate the image exactly. You're essentially getting lossless compression
Or else the program you're using is actually doing lossless JPG compression. Lossless JPG exists. I've heard of it, but it's not a "normal" mode of things - but I suppose programs could be doing it in some cases.
A couple of other questions -
1) Are you closing the program you're using between open-save-close sequences?
2) Are you making any changes, however slight, to the file each time you open it?
It's possible that the program is caching your file and not actually re-compressing the file each time, if you aren't making any image changes. So the image data would be maintained.
Posted by mark miller on October 16, 2010 at 11:51 PM
I just repeated the test with another 2.57 Mb jpeg image in CS 4, cropped and viewed at 100%. I made a duplicate that remained untouched for comparison while save and close and re-open operations were done on the other. I created an action for this process, with each opening, a healing brush was applied to a spot, the image was then "Save"d with Q12 each time, , then reopened, with another healing brush operation in a second spot. Each time the action was played, the healing brush applied once, image "save"d, then re-opened, new healing brush spot, then saved, then re-opened, I repeated this at least 10 times for the equivalent of at least 20 healing brush operation, save, close and re-open cycles. The image stayed exactly at 2.57 MB throughout. I watched carefully for any artifacts or jpeg degeneration, and saw none whatsoever. I copied the test image with all the operations, pasted it on the unchanged image, and blended the layer for differences, Result, completely black, indicating, I presume, identical layers,. I then pasted a layer of the unchanged on top of the test image, and checked for difference, and once again, identical.
Conclusion, I am wondering if we're not being overly concerned about re-saving jpeg images, as long as the quality is highest level, and minor operations are done. I would be concerned if even the slightest degradation occured, but by these tests, I see absolutely zero, Say, a client or agency has your jpeg, and something minor needs to be done, a slight alteration they can do on their end without having to request work being done with the original tiff, I don't see any degradation on the jpeg whatsoever for them to open, alter and save. Thoughts?
Posted by David Bostedo on October 17, 2010 at 12:06 PM
Conclusion, I am wondering if we're not being overly concerned about re-saving jpeg images, as long as the quality is highest level, and minor operations are done.
Well, yeah, I think we are sometimes Mark. As I said, I keep RAW and JPG...only using TIFFs or PSD when I want layered working files.
At the same time, when you look at the "black" difference image, look carefully and maybe check the histogram. The differences could be very minor and appear to be solid black. There should actually be some difference over a bunch of saves even at the highest quality (unless there is some kind of lossless JPG going on).
IIRC, The old jpeg 2000 standard was supposed to be lossless. It never caught on, though. So, unless one is working in jpeg 2000, jpeg files will lose pixels after each save, regardless of the compression level.
While such small losses at low compression levels wouldn't cause problems in areas with lillte detail or color transition, these losses would become apparent in a very detailed image. This may not be a critical problem for small web images, but may become an issue if a larger file needed to be printed, or displayed at a very large size on a monitor.
My own working method is to create a master file (tiff or psd) and then create duplicates of that file for targeted uses and /or sizes.
Conclusion, I am wondering if we're not being overly concerned about re-saving jpeg images, as long as the quality is highest level, and minor operations are done.
It may not be as big an issue with large files, but I'll guarantee it has huge impacts on "web" size files such as the smaller standard here on NPN. Try the experiment with one of those and watch the compression tiles appear and grow. It's a concern for us because we have to prep multiple versions for assorted web clients, and we don't dare keep working on the original small file.
Posted by David Bostedo on October 17, 2010 at 10:50 PM
I've seen this done as you are doing Mark a few times, but I never actually did it for myself, and I thought I should.
So I ran this experiment myself, on the image I posted last week that got an EP - since it's pretty highly detailed and I had a smaller version sitting around. I did all the saves at quality "!2" in PS, which is the highest. I definitely see differences even after only a couple of saves - but I have to use the "difference" mode along with the original image and zoom to 400%. I ran up to 30 save cycles, and the differences clearly increased, but were still not hugely significant.
I also tried this with the 720 pixel posting version, and it had about the same effect. So the image size, for this one particular case that doesn't depend on smooth gradients or straight lines, the file size didn't make too much difference.
I also ran it with a quality of 10, and saw more dramatic differences after a maybe 6 or so saves. So the quality level definitely seems to make a difference. (Which is actually obvious, but I still thought I'd run it to observe the difference.)
So I'm going to post a couple of pics, showing the difference - all images are zoomed to 400%, so they're very fine detail. If you want to see the original 720 pix image, it's here.
Posted by David Bostedo on October 17, 2010 at 10:52 PM
Here's the first image, showing the result of overlaying the re-saved image on top of the original with the blend mode set to "difference". These are both zoomed into the exact same area, at 400% zoom level. The left is the result of saving 10 times and the right is after 30 saves.
As you can see, after 10 saves, some difference are visible, and after 30 it's much more evident. But these are still dark differences, which means that the change isn't drastic. (White would mean a huge difference, and black means no difference.)
Posted by David Bostedo on October 17, 2010 at 10:54 PM
This is the same section of the image as in the "difference" pic above. In this case though, the left image is the original image, and the right side is the image after 30 saves.
You can see some chunky looking ugly artifacts. But since this is also zoomed to 400%, it's not too bad. For 30 saves, using quality 12 maintains the file very well.
Discussion
14 repliesI'd like to re-size a folder of jpegs, perhaps add some file info, and maybe just tweak ever so slightly. I am wondering what I can get away with and avoid any degradation. Of course, the proper way is to work with the original tiffs, and then save the changes as jpegs, and I do this usually.
I did a test on a jpeg file in CS4. I added file info, and then
closed and saved the file under "save as" to another jpeg
with a new name. I opened the new file, and repeated this process several times, noting the compressed and uncompressed file sizes,
The size did not change at all, apparently no loss of information with saving as jpeg, even several times.
So, there's more to this. Any explanations? Maybe I shouldn't be so fearful working in jpegs for minor changes?
I took a section of a jpeg, and duplicated it for comparison. The were both 385K. In one I created an action command which used one clone stamp operation, and then saved that file, and then re-opened that test file, performed that clone operation again, and then re-saved using "save" the changes, and re-opened, cloned and saved, etc. I repeated this action hundred times on the test image. The file size stayed the same from start to finish, plus a 100% I could not discern any changes, or any lossy degradation whatsoever. So I don't know what to make of this.
As you can see from my experiment, even with the "Save" command, I could not see any loss, even after 100 repetitions. Like I said, I have a whole folder of images with which I'd simply like to make minor alterations, like add file info, and then simply "save". The other option is for the Alamy guidelines/suggestions, to save jpegs on "baseline" for better apparent quality.
I don't want to start from scratch when perhaps the "save" command on a jpeg with very minor alterations (or something as innocuous as adding file info or down scaling perhaps) will not alter the qualilty anyway, if that be the case.
A couple of notes though - if you're not saving at the highest quality, problems can set in quickly. Also, the JPG algorithm is image dependent, so some images might show issues that others wouldn't even with a few saves.
Finally, don't always trust that the same file size means nothing changed. Especially if you have a color profile, EXIF, or other metadata saved with the file, since it will be constant. You might want to take your original JPG, and your final after 100 saves, and overlay them on layers in PS. Then setting the top layer blend mode to "difference" will show you how much difference is there in detail.
Here are some examples of people doing what you're doing but with different images/compression/programs :
Video of a simple image being saved multiple times : this shows issues quickly because of very smooth gradient areas, and hard edge text.
Re-saving 100 times : similar to what you're doing, saved at 80% quality each time
Multiple compression values : Another example using random amounts of compression.
That would tell me that for the image you're using, and the program you're using, the lowest compression JPG algorithm is able to recreate the image exactly. You're essentially getting lossless compression
Or else the program you're using is actually doing lossless JPG compression. Lossless JPG exists. I've heard of it, but it's not a "normal" mode of things - but I suppose programs could be doing it in some cases.
A couple of other questions -
1) Are you closing the program you're using between open-save-close sequences?
2) Are you making any changes, however slight, to the file each time you open it?
It's possible that the program is caching your file and not actually re-compressing the file each time, if you aren't making any image changes. So the image data would be maintained.
Conclusion, I am wondering if we're not being overly concerned about re-saving jpeg images, as long as the quality is highest level, and minor operations are done. I would be concerned if even the slightest degradation occured, but by these tests, I see absolutely zero, Say, a client or agency has your jpeg, and something minor needs to be done, a slight alteration they can do on their end without having to request work being done with the original tiff, I don't see any degradation on the jpeg whatsoever for them to open, alter and save. Thoughts?
Well, yeah, I think we are sometimes Mark. As I said, I keep RAW and JPG...only using TIFFs or PSD when I want layered working files.
At the same time, when you look at the "black" difference image, look carefully and maybe check the histogram. The differences could be very minor and appear to be solid black. There should actually be some difference over a bunch of saves even at the highest quality (unless there is some kind of lossless JPG going on).
I think I may give this a shot myself.
While such small losses at low compression levels wouldn't cause problems in areas with lillte detail or color transition, these losses would become apparent in a very detailed image. This may not be a critical problem for small web images, but may become an issue if a larger file needed to be printed, or displayed at a very large size on a monitor.
My own working method is to create a master file (tiff or psd) and then create duplicates of that file for targeted uses and /or sizes.
Just my 0.0002.
--P
It may not be as big an issue with large files, but I'll guarantee it has huge impacts on "web" size files such as the smaller standard here on NPN. Try the experiment with one of those and watch the compression tiles appear and grow. It's a concern for us because we have to prep multiple versions for assorted web clients, and we don't dare keep working on the original small file.
So I ran this experiment myself, on the image I posted last week that got an EP - since it's pretty highly detailed and I had a smaller version sitting around. I did all the saves at quality "!2" in PS, which is the highest. I definitely see differences even after only a couple of saves - but I have to use the "difference" mode along with the original image and zoom to 400%. I ran up to 30 save cycles, and the differences clearly increased, but were still not hugely significant.
I also tried this with the 720 pixel posting version, and it had about the same effect. So the image size, for this one particular case that doesn't depend on smooth gradients or straight lines, the file size didn't make too much difference.
I also ran it with a quality of 10, and saw more dramatic differences after a maybe 6 or so saves. So the quality level definitely seems to make a difference. (Which is actually obvious, but I still thought I'd run it to observe the difference.)
So I'm going to post a couple of pics, showing the difference - all images are zoomed to 400%, so they're very fine detail. If you want to see the original 720 pix image, it's here.
As you can see, after 10 saves, some difference are visible, and after 30 it's much more evident. But these are still dark differences, which means that the change isn't drastic. (White would mean a huge difference, and black means no difference.)
You can see some chunky looking ugly artifacts. But since this is also zoomed to 400%, it's not too bad. For 30 saves, using quality 12 maintains the file very well.