modifying image metadata causes quality degradation?

  • Thread starter Thread starter Bob Powell [MVP]
  • Start date Start date
B

Bob Powell [MVP]

Hello,
The problem is not because of the metadata but because JPEG compression is
lossy and unless you save at 100% fidelity you will always degrade the
image.

If the image quality is set to 90% on the first save the cumulative effects
of lossy compression will make the image quality drop from 100% to 90% then
81% and 73% and so-on.

Unfortunately, saving JPEG with 100% creates large files.

--
Bob Powell [MVP]
Visual C#, System.Drawing

The Image Transition Library wraps up and LED style instrumentation is
available in the June of Well Formed for C# or VB programmers
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

The GDI+ FAQ RSS feed: http://www.bobpowell.net/faqfeed.xml
Windows Forms Tips and Tricks RSS: http://www.bobpowell.net/tipstricks.xml
Bob's Blog: http://bobpowelldotnet.blogspot.com/atom.xml
 
Hi everyone,

I'm using the System.Drawing.Imaging.Bitmap to retrieve and modify the
metadata tags (user comments, keywords etc) of JPEGS. I was wondering if
changing these tags in any way degrades the image quality of the JPEG. I am
using SetPropertyItem to change the tag value and then calling the Save
method to save the JPEG under a different name (you have to do this because
GDI holds a lock on the original file)....

If there is an image degradation problem, I will have to port the metadata
to a database, which I would like to avoid at all costs.

Thanks for any info on this folks.
 
Hello,
The problem is not because of the metadata but because JPEG compression is
lossy and unless you save at 100% fidelity you will always degrade the
image.

If the image quality is set to 90% on the first save the cumulative effects
of lossy compression will make the image quality drop from 100% to 90% then
81% and 73% and so-on.

Unfortunately, saving JPEG with 100% creates large files.

That's a little misleading; loss when saving at the same quality
repeatedly is not equal. If the data hasn't changed, the forward DCT
will generally produce nearly the same values as were saved
previously.

The lower the quality setting, the more the generational loss; but at
Q90, you won't see 10% loss of quality every time you save.

Decent imaging libraries include the ability to modify metadata
without recompressing JPEG files. If the C# library doesn't do this,
it is quite simply broken.
 
Back
Top