Orquid "Phoenix"

Orquid "Phoenix"

by ceinmart

submit your photo


Hall of Fame
View past winners from this year

Please participate in Meta
and help us grow.

Take the 2-minute tour ×
Photography Stack Exchange is a question and answer site for professional, enthusiast and amateur photographers. It's 100% free, no registration required.

Has anyone ever noticed that if you open a image in mspaint (.jpg, .jpeg) and then just save it, the image size is reduced by many folds. I use this method to reduce the file size.

However, I am not sure about the quality loss due to this. Can anyone please tell/explain the quality loss if any using this method?

share|improve this question
    
Yes everyone has noticed this. I would highly suggest not using MS Paint. Basically anything is a step up from MS Paint. Try Xnview or Irfanview, among thousands of others. –  dpollitt Feb 19 '13 at 16:40
    
However, I have noticed that opening a Jpeg with MSPaint and resaving it reduces the filesize by anywhere from 20-50%, while the quality of the image appears unchanged. Even upon zooming in to the pixel level I see no changes in pixelation of the newly saved image. Perhaps the camera taking the original Jpeg stores extra data that MSPaint disregards when resaving, resulting in a much smaller file? Can anyone proffer an explanation? –  user21291 Jul 26 '13 at 12:39
    
@user21291 It is possible (likely, even) that MSPaint is discarding color profile and other metadata. That would explain an size loss with no apparent change to the image. However, I think it's most likely that the change is subtle and you just don't notice it without careful comparison. If you can post an image before and an image after, we could look (not via the imgur service used by this site, though, because that strips out such info). –  mattdm Jul 26 '13 at 23:37
add comment

4 Answers

up vote 4 down vote accepted

The fact that the image file gets smaller tells you that you are losing quality. The JPEG format is optimised for a size vs. quality compromise, so the file size is more or less a direct measure of the quality.

If you view the image and zoom to 1:1 scale or more, you can usually see the artifacts caused by the JPEG compression.

The compression works by making 8x8 pixel blocks with a color gradient to resemble the original data as close as possible, then the difference between that mosaic and the original data is stored with the amount of precision that corresponds to the quality level chosen. The higher the compression, the more of the mosaic is visible.

Here is an example of how the compression artifacts are visible around the edges of an object (a maple leaf) against a smooth background (the sky):

enter image description here

share|improve this answer
    
In addition to JPEG compression, Huffman encoding is used to further compress the bytes. Some programs will optimize the huffman codes. Optimized huffman encoding is an additional 'lossless' compression on top of 'lossy' jpeg compression. ANy program may do one or the other of those. –  Octopus Jul 26 '13 at 18:35
add comment

Yes quality will most likely be lost. The JPEG format implements lossy compression, i.e. data integrity is traded off against filesize. When saving a JPEG you can usually decide what quality setting to use, and thus how much to compress the files, it sounds like MsPaint is using a default quality value which is lower than the quality setting of the files you're opening, which is why they are ending up smaller.

A better approach is to use a tool that allows you to choose the quality setting so that you can decide for yourself what loss of quality is acceptable in pursuit of smaller file sizes.

share|improve this answer
    
Thanks for your answer, Is there any way that I can check the actual loss of quality, is there any tool available for that. –  Ankit Feb 19 '13 at 16:27
    
Quality will definitely be lost. Even at maximum quality, jpeg will alter the image slightly, every time. At lesser settings, like what MS Paint uses, it will alter the image significantly. –  cadmium Feb 19 '13 at 22:24
    
Highly pedantic note: re-saving thee same image will reach an equilibrium after a handful of opens and resaves at the same quality level. –  mattdm Feb 19 '13 at 22:26
add comment

Multiple encodings with any lossy format will result in additional quality loss. This is what is called generations of loss and is a concept that dates back to analog techniques where each time you made a copy, the quality of the copy was inferior to that of the original.

Digital tools allows us to avoid generational quality loss when using lossless formats (formats that store all available information without deterioration), however lossless formats require much more space and are therefore rarely used for final output

Lossy formats such as JPEG work by storing an image that closely resembles the original but throw out information that they deem to be unnecessary. Encoding an image more than once will generally reduce quality further since the algorithm does not have the original full quality image to work from and must instead encode the lower quality image.

The file size will generally give a rough estimate of loss of detail if you are encoding within the same compression scheme, at least when files sizes decrease. It is however possible to increase the size of an image (say for example you had a lossless image, saved it as a 10 quality JPEG and then resaved that as a 100 quality JPEG). While the file size would grow, it would be storing noise at high quality rather than information from the original image.

In theory a tool could compare the pixel data of an original image with the differences in the final image to get a better estimate of information loss, but it's hard to quantify how meaningful those changes may be. For example, if every pixel in the image was a few color values brighter, the overall image would seem very similar, where as if one pixel was off by a large value, it would be much more obvious, even if the entire rest of the image was untouched. Similarly, if areas of fairly uniform color are actually made uniform, it may be a large change in pixel values, but have a limited impact on how someone perceives the image.

share|improve this answer
add comment

I'm turning a comment I made into an answer to further explain why I think that smaller size doesn't necessarily mean a loss of quality, although it often does.

I believe generally that MSPaint will degrade the quality of your images when you save them for the exact reasons Guffa illustrated. However, it doesn't always change the quality even though it might change the filesize. One file I tried just now actually grew by 10% in size and the quality was exacty the same.

You can test for quality difference by opening both images in Photoshop and blending them with 'Difference'. The differences are usually pretty subtle, but you will see a few odd pixels close to black but not quite that indicate a difference.

Now, MSPaint has no way to set the jpeg quality you save an image so we can only assume it is saving with a quality of maybe 75% (who knows?).

Other programs can give you finer control of quality settings, but I just now created three files of the same image and all three are different sizes even though there is no difference per pixel between those files. They are of an image 940x350 pixels and they have file sizes of 194,571; 188,924; and 170,074.

The first was saved from Photoshop CS5 using Quality:10 and Baseline "Standard" settings, the second was saved using Quality:10 and Baseline Optimized settings and the third was saved from the 'Save for Web & Devices' option that offers quite a bit more control over the quality settings of the file. Here I used 80% Quality and checked the 'optimized' box. All of these images are identical pixel for pixel.

My point is that just because a jpeg file is smaller, it doesn't mean that there has been some quality loss.

Why not? What is going on?

If you take a jpeg file with large areas of similar color and saved it 'optimized' it could actually lose a significant amount of size because there is another algorithm called huffman coding that is applied after the jpeg blocking.

So to answer your question: the only way to know for sure about quality loss is to do a pixel-to-pixel comparison with a 'Difference' layer. Its a good bet that with MSPaint you are, in fact, losing quality.

Here is a link to more info on Huffman Coding

Some applications have a fixed Huffman table that they use for all images. While others will try to build an 'optimized' huffman table specific to the data in that file.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.