Lossless JPEG resave

HH
Posted By
Howard_Hoffman
Mar 11, 2007
Views
704
Replies
24
Status
Closed
Is there a way to import a JPEG file, do some editing, and only re-compress if necessary when saving it? For example, cropping on MCU boundary, rotation. I’ve heard about Better JPEG before but did not try it yet. Any other suggestion?

Thanks1

MacBook Pro 16” Mockups 🔥

– in 4 materials (clay versions included)

– 12 scenes

– 48 MacBook Pro 16″ mockups

– 6000 x 4500 px

B
Bernie
Mar 11, 2007
Save your working copy as a PSD. ONly save your final file as JPEG
D
deebs
Mar 11, 2007
I prefer the term "export".
In the sense that a primary data file may export to other file formats given the options available to those exported formats.
C
chrisjbirchall
Mar 11, 2007
If quality is paramount, Jpeg is a non starter. Only by saving your files in a lossless format, such as TIFF, will the original data be honoured.

There is no such thing as an uncompressed Jpeg. Even "Maximum Quality" discards a phenominal amount of pixel data.

HD storage is so cheap now, there rally is no reason to save valuable image files as Jpegs unless they are destined for the internet.
RP
Russell_Proulx
Mar 11, 2007
Howard’s question made me wonder the same thing.

I know, JPG is lossy and is therefore avoided except at the final delivery stage and only then if it’s really necessary. The higher the JPG quality setting the less is lost and all that…

But.. If one opens a JPG, makes small modification and then re-saves it at the same compression, what damage is really done? What kinds of modification will create additional JPG artifacts? How bad is the real damage?

As a test I just created an action which opened a JPG image, enlarged the canvas by 101% and then used Trim to return to (more or less) the same original image size. This was then saved as the same JPG file, overwriting the original. I kept a 2nd copy for comparison.

Perhaps I’m missing something, but I ran this action almost 100x and the result looks identical to the original JPG.

Is is possible that if no tonal change is made to an image then the JPG will use the same artifacts that were originally created when it was saved and no new ones are produced?

Just seems strange that the cumilative affect of re-saving a JPG is NOT producing the damage I would have expected. Is the affect so subtle that it would have to be resaved 1000x before any real damage is done?

Thus I wonder if the answer to Howard is that rotating and/or cropping a JPG and then re-saving it at the same (or higher?) compression settings will not adversely affect the image (at least not one that would be perceptible).

Russell
B
Bernie
Mar 12, 2007
Perhaps I’m missing something, but I ran this action almost 100x and the result looks identical to the original JPG.

1) Did you close and reopen the saved images? If not, you nonly have one generation of JPEG compression added onto the file.

2) Try copying the 100th file onto the original and place the layer in difference mode, this will show you the, well differences.

BTW: Russell, checked out your site, I live on Melrose, small world! 🙂
RP
Russell_Proulx
Mar 12, 2007
I live on Melrose, small world!

We should meet for a coffee on Monkland one day 🙂

Did you close and reopen the saved images?

Yes, the action ‘opens -> modifies -> saves -> closes’. I sat there and pushed the button 100 times.

Try copying the 100th file onto the original and place the layer in difference mode, this will show you the, well differences.

I just did and there are NONE. Go figure 🙂

It would appear that the JPG compression does not modify the existing artifacts (the ones that were generated during the 1st compression) unless it needs to (ie you’ve have made a tonal change to the image).

I don’t know if this is correct, but that’s what this test seems to indicate.

Russell
JO
Jim_Oblak
Mar 12, 2007
Image compression is only bad if you can see degradation. This is why many of us watch DVD movies without complaint about picture quality. It is possible to have unnoticable degradation on successive JPG saves. If you need to save the file 100 times, you should hire a better artist. 🙂
HH
Howard_Hoffman
Mar 12, 2007
I understand having TIFF or RAW is the way to go. However, that’s not the point. I do have JPEG file that I want to do simple editing, for example, cropping and some touchup.

If cropping is done at the MCU (normally 16×16) boundary, saving the result should have not require any re-compression. This is what the BetterJPEG standalone program does.

They also have a plugin in beta. It "imports" an image into PS. And when you save, only those MCU that are changed will be re-compressed. You can call this "export". Just keep in mind that we started with JPEG, not a lossless format.

I would like to ask if any people have tried plugin like that and how is the result.
RP
Russell_Proulx
Mar 12, 2007
Jim,

You misunderstood the point of what I’m doing. The thread began with Howard asking what would be lost when opening a JPG, doing a crop and then re-saving. The response was the usual "re-saving JPGs causes damage and should be avoided" that I too state when asked. But I began wondering just *how much* damage really is done (before telling students that it’s a no-no).

Well, I’ve tested the warning and so far I have yet to see any noticeable damage (I figured 100x should really demonstrate a problem). The answer might therefore be that the majority of the damage to a file (when saving as a JPG) is done during the initial compression. Opening and re-saving the compressed file seems to have very little (if any) further affect on the image quality.

So I would be tempted to say to Howard, go for it.

Russell
RP
Russell_Proulx
Mar 12, 2007
Howard,

From what I can see: opening a JPG in PS, doing a crop and re-saving does affect the quality enough to be noticeable. Why spend 25$ on a tool that adds extra steps to one’s workflow and offers little if any visible benefit?

Russell
JO
Jim_Oblak
Mar 12, 2007
Russell, I understood your point. My point was that it is unusual for anyone to need to resave a JPG file so many times – – so it is unlikely that so many resaves would ever happen and that any pronounced image degradation would occur.

Your experiment with the 100 file saves seems extraordinary and unlike any practical editing that might occur on an image in realistic circumstances. You may see more pronounced degradation with another type of image transformation. Unfortunately, I cannot think of a technique that might be practically employed 100 times for a ‘real world’ scenario.

If there is no visual degradation of an image, successive JPG saves at maximum is not a critical problem, as you have demonstrated. However…

Saving lossy JPG files at maximum quality (least compression) may still not be an ideal practice as you may get comparably small file sizes with ZIP or LZW lossless compression in TIFF.
RP
Russell_Proulx
Mar 12, 2007
Jim,

I was saving at quality "8" and not the maximum "12". I would have expected that there would be *some* image degradation (especially @ 100x re-saves). There was none (as far as I can see). Why?

Russell
B
Bernie
Mar 12, 2007
Hum,

Russell, what kind of image was it?

JPEG artefacts tend to appear more in regions where there is a high contrast
C
chrisjbirchall
Mar 12, 2007
The very act of saving a file in the Jpeg format will degrade the image. You don’t have to edit or alter the image in any way, if you save it – as opposed to simply closing it – you WILL lose quality.

Russell: Your action to save and reopen must be flawed, I’m afraid. One save/open cycle at a quality setting of 8 will show differences.

Here’s a simple test:

1: Open a small image.

2: Make a duplicate (right-click the blue bar at the top of the image window)

3: Drag the duplicate onto the original (holding the shift key for perfect registration)

4: Set the new layer’s mode to "Difference" (the whole image will go black because there is no difference)

5: Make a "Threshold" adjustment layer and drag the slider all the way to the left.

This is your "control" test to prove the methodology. The image will (should) remain black.

Now. Do the same test again. This time save and close the "duplicate" (at Jpeg quality 8 ) after step 2 and reopen it before proceeding to step 3.

This time when you drag the Threshold slider to the left, you will see parts of the image go white indicating distinct "differences" between the original and saved/opened copy.
HH
Howard_Hoffman
Mar 12, 2007
Russell,

It really depends on the original compression and image characteristic. The idea to do some editing without re-compression has been around. Getting the negative or high quality JPEG is the ideal way to deal with compression loss. However, in real life, it’s not always possible. I view saving-to-jpeg without unnecessary re-compression as a desirable feature. I am trying to figure out which tool can work with PS.
JO
Jim_Oblak
Mar 12, 2007
I view saving-to-jpeg without unnecessary re-compression as a desirable feature.

I’m not sure what is meant. You will never see this feature as it is impossible. JPEG is a compressed format so it is always going to re-compress when saving. If an application is not compressing at the time of saving, it is not producing a JPG file.
RP
Russell_Proulx
Mar 13, 2007
Make a "Threshold" adjustment layer and drag the slider all the way to the left.

Chris,

I had omitted this step and YES I now see a difference. Thank you for showing me the way 🙂

The results now are: white pixels in a few shadow areas which contain very little useful information. Keep in mind that I’m not comparing the JPG to an original uncompressed version as that is not the question posed by this thread. I’m opening a JPG previously saved with a quality of 8 and re-saving it at the same quality.

The affect of a 1x open/save vs a 100x open/save seems to produce identical white pixels in the same places (indicating areas of change). From what I can see an open/save/re-open of a JPG with a quality of 8 does not produce enough change to warrant cautioning to avoid doing so. Yes there is certainly damage, but not to the degree I had previously thought. It’s really pretty minimal and not worth losing any sleep over. Certainly not worth spending any money on a tool that claims to avoid this amount of damage.

I assume anyone who need to to open and crop a JPG is going to be so close to the final application of the image that any damage would be imperceptible If you want to do serious editing then I agree that it’s best to work on an uncompressed version.

Thanks for the help Chris 🙂

Russell
RP
Russell_Proulx
Mar 13, 2007
I am trying to figure out which tool can work with PS.

Howard,

I suggest you do some testing as I have and use the comparison method outlined by Chris to see just how much damage recompressing is really causing to the images *you* are using. My test seems to indicate that the difference is not worth sweating about.

One can always re-save a JPG as a PSD until your editing is done and that will only require a 1x re-save to JPG for finally purposing.

I view saving-to-jpeg without unnecessary re-compression as a desirable feature.

Sure, if it made any real difference. If Adobe wanted to offer a similar ability as the utility you cited (Better JPEG) that would be nice but not worth paying for an updrade. My test seems to indicate that it’s really not a problem that needs solving.

This reminds me of the Dan Margulis’ challenge to anyone to prove that 16 bit editing offers any real advantage that could be demonstrated in an actual print. I don’t want to go there 😉 But it does underline the fact that there *are* some theoretical advantages that do not sometimes prove their worth in the real world. This might be one of them.

Russell
HH
Howard_Hoffman
Mar 13, 2007
Jim,

I’m not sure what is meant. You will never see this feature as it is impossible. JPEG is a compressed format so it is always going to re-compress when saving. If an application is not compressing at the time of saving, it is not producing a JPG file.

That’s not true. MCU that has not been changed can be saved directly, bit by bit, without any re-compression.
HH
Howard_Hoffman
Mar 13, 2007
Russell,

I’ve run my tests and the difference is quite obvious. The project has a lot of old photos which are compressed more than I like. I can keep all the originals in a separate folder. However, if the editing is really simple, a lot of time I would prefer replacing the file so that I don’t have to check different places.
JO
Jim_Oblak
Mar 13, 2007
That’s not true. MCU that has not been changed can be saved directly, bit by bit, without any re-compression.

Why are you saving images if you have made no change to them? What is the point? The MCUs that you have not touched might be unaffected in recompression but the MCUs that you have edited will be turning to mush after successive saves.

My comment was true unless you can demonstrate a practical application where someone needs to save a JPG without having made a change that affects all MCU. There is a big difference between possibility and practicality.
SK
Susan_Khammash
Mar 13, 2007
A similar question……….I receive tons of JPG photos from clients to use in creating newsletters, etc. I usually open them and do whatever needs to be done, then re-save as TIFS. Do I lose anything when doing this?
Thanks
JO
Jim_Oblak
Mar 13, 2007
Saving in a lossless compression format, which is possible in the common TIF file, is not a problem. You are not making a low quality compressed image any worse by saving it as a TIF unless you are a bad artist.
C
Clyde
Mar 31, 2007
wrote:
Is there a way to import a JPEG file, do some editing, and only re-compress if necessary when saving it? For example, cropping on MCU boundary, rotation. I’ve heard about Better JPEG before but did not try it yet. Any other suggestion?

Thanks1

Well, you could use JPEG2000 in Lossless mode.

Clyde

Master Retouching Hair

Learn how to rescue details, remove flyaways, add volume, and enhance the definition of hair in any photo. We break down every tool and technique in Photoshop to get picture-perfect hair, every time.

Related Discussion Topics

Nice and short text about related topics in discussion sections