modifying image metadata causes quality degradation?


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
 
Ad

Advertisements

T

Travis

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.
 
Ad

Advertisements

S

Severian

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top