Is editing metadata of a JPEG destructive to the image? If I edit "File Info" > "Description" in Photoshop, then save.... am I causing the same image degradation as if I edited the image, then re save the JPEG?
2 Answers
Generally, when you do this with an image editor like Photoshop, yes, this is destructive. That's because the software doesn't keep a JPEG-encoded version of the image in memory to write back unchanged. It decodes it to its own internal working format, and then re-encodes to whatever output format you want when you save. (It may be smart enough to use similar encoding options, but degradation will still occur.)
On the other hand, if you use software like Exiftool which is specifically designed to edit metadata and not actual images, no problem. This kind of software will copy the image data itself unchanged.
If you use RAW conversion software like Lightroom, which is meant for non-destructive editing of source images, your mileage may vary when working with JPEG files. Editing non-RAW files is not really the main use case of these programs, but they generally can, and then usually store any changes to the base JPEG as stacks of changes to apply (so those can be altered). That means they can know something like "oh, no image changes made" and not bother to re-encode anything. However, if you set export parameters to anything other than the exact same ones as the original encoding, that will probably force reencoding, which (again) will be lossy.
But that's a long paragraph to explain a special case. In general if you just want to change metadata, it's best to use a program designed for that purpose.
-
\$\begingroup\$ Both Adobe Bridge and Lightroom can edit metadata in the way the OP describes without a destructive re-encoding of the file. Are you sure that Photoshop can't do the same? \$\endgroup\$– StarGeekOct 27, 2019 at 15:28
-
\$\begingroup\$ @StarGeek Although I haven't used the most recent version of Photoshop, pretty sure, yes. Those other programs are from Adobe, but they are not image editors in the same way, and are designed for non-destructive operations. \$\endgroup\$– mattdmOct 27, 2019 at 16:55
-
\$\begingroup\$ Photoshop of course can do it; it depends on your settings. The defaults will reduce it to 80% quality, everytime you save. Also, if you set Photoshop to DNG as standard (which is otherwise a good idea), this would result in a back-and-forth conversion for this use case. \$\endgroup\$– AganjuOct 27, 2019 at 17:05
-
2\$\begingroup\$ @Aganju — no, that's not the way those compression levels work at all. \$\endgroup\$– mattdmOct 27, 2019 at 17:05
It depends on the software you use for it, and especially the settings you have in them.
If you check in the save-as dialog under JPG, there are normally 'additional' or 'advanced' settings, and in there, you can set the quality target for the JPG. The default is often 80%, but you can set it to anything between 1% and 100%.
You should always set it to 100%, unless you urgently need to save space.
I tested with Lightroom, and when set to 100%, the resulting image is byte-identical to the source. Your tool's results may vary...
-
\$\begingroup\$ If you're not making any image adjustments in Lightroom, it may indeed not apply any changes. Lightroom is a different kind of software. Do you have Photoshop handy to test if this happens in the same way there? \$\endgroup\$– mattdmOct 27, 2019 at 17:05
-
3\$\begingroup\$ JPEG 100 does not mean "lossless" in any way. Also: What do you mean with
byte-identical
? That re-saving the 100% file with 100% results in a file the same size? That would not necessarily indicate a bit-identical transcoding. \$\endgroup\$– floliloOct 27, 2019 at 17:20 -
3\$\begingroup\$ Wrong assumption. At 100% quality the JPEG compression is still computed and there are round-off errors. If I load a JPEG from my camera (97%, half-chroma), and save it at 100%, full-chroma, there are still 11% of pixels that have not the same value... In fact experiments show that the algorithm "settles", differences decrease with generations, until generations becomes identical (requires 7-8 iterations IIRC, with that same picture the difference between 2nd and 3rd generations is 3%). \$\endgroup\$– xenoidOct 27, 2019 at 17:40
-
\$\begingroup\$ @xenoid
In fact experiments show that the algorithm "settles"
You mean like this? youtube.com/watch?v=_h5gC3EzlJg \$\endgroup\$– floliloOct 27, 2019 at 19:22 -
\$\begingroup\$ I can't tell, this video seems to be showing two things at the same time, confusing... What I did once is an ImageMagick-based script that takes a JPEG, adds a small circle to it (so I can tell which generation), saves to PNG and then converts the PNG to JPEG, always wiih the same parameters (using intermediate PNG to insure IM isn't reusing some data from the JPEG). Outside of the area with the circles, the differences between generations decrease, until there are no difference at all.... \$\endgroup\$– xenoidOct 27, 2019 at 19:55