Wednesday, December 25, 2013

Decreasing JPEG image file size

So friends/family have asked me time and again regarding this and it had become a major FAQ asked of me.
So here goes.

You can decrease the file size of a JPEG image in two ways: decreasing the image quality and decreasing the resolution. When you get a file whose size you want to decrease, try reducing the quality first, if that brings the file size under the threshold, you are looking for then you are done, if not, try decreasing the resolution.

Theory
The quality setting of JPEG image can vary from 0% (bad quality) to 100% (best quality) and refers to a parameter of the compression algorithm used by JPEG. Needless to say, digital cameras save images at quality setting of very near 100% and decreasing this to 80% will decrease the file size of the image by almost a third. The same process when applied to images that have come from scanners and mobile phone camera does not yield much reduction in file size - maybe those devices have already set the quality level to lower value.
In my experience, I have never been able to visually tell apart the differences between an photograph saved at 100% and the one saved at 80%. Technically, decreasing the image quality will cause the loss of information but you can decrease the quality down to 80% without any perceivable loss - so don't worry about it. (Details about JPEG quality here: wiki | fotoforensics | stackoverflow)

Decreasing the resolution simply refers to decreasing the number of pixels (dots) used to represent the image. Decreasing the number of pixels simply decreases the number of dots in the image, less the number of dot, less the amount of information that the computer has to save in the image file.

Instructions
So here's how to decrease the file size of image:

  1. Download and install IrfanView on your Windows PC. Its just a 2MB download.
  2. Open the JPEG image you want to compress using IrfanView - just double clicking on the image file would do since IrfanView setup would have set itself as the default program for opening JPEG files.
  3. Click on the Save as button (looks like a Floppy) and just save the image as JPEG without changing any setting. IrfanView has its JPEG quality set to 80% by default and this ought to decrease its file size. For reference, a 2592 x 1728 photo taken by my Canon 550D reduced in size from 2.5 megabytes to 702 kilobytes just by opening it in IrfanView and saving it.
    Quality setting in IrfanView
  4. If you want to decrease the file size further, you will have to decrease the resolution. NOTE THAT DECREASING THE RESOLUTION WILL CAUSE LOSS OF CLARITY AS THE NUMBER OF PIXEL REPRESENTING THE IMAGE WILL DECREASE. In case you have a very high resolution image, you can go ahead with this anyway. In IrfanView, press Ctrl+R to bring up the Resize/Resample dialog. Click the button that says "Half" - this will decrease the X and Y resolution to half their value. And then save the file. For reference, a the image in the previous step when resized down from 2592 x 1728 to 1296 x 864 caused the file size to reduce from 702 kilobytes to 223 kilobytes. Overall decreasing the quality to 80% and halving the resolution resulted in decreasing the file size to a tenth of the original size.
    Resize / Resample dialog box in IrfanView
NOTE: You can also set the image to other resolutions, just make sure you leave the "Preserve aspect ratio" box checked. Selecting a particular area of the image in IrfanView and pressing Ctrl+Y will allow you to cut out (crop) those areas of the image that you don't require - This will also help you cut down the image file size. Just remember - less the number of pixel in an image, lower its file size.

0 comments:

Post a Comment