4
$\begingroup$

When I download this image:

https://www.ucn.edu.ni/media/2016/03/graduados-ucn-nicaragua.jpg
(source: ucn.edu.ni)

then its total size is 341,0 kB.

The image has a width of 2880 pixels and height of 1100 pixel and 1 X/Y resolution pixel/in.

I opened the image with gimp and pressed scale image and reduced the width to 1920px and auto adjusted height of 733px, and keeped the resolution as it is and used the interpolation cubic. If I now export this as a jpg with 90% quality, then the image size is 546 kB!

How is that possible and how can I avoid that?

$\endgroup$

2 Answers 2

6
$\begingroup$

JPEG is a lossy format and depends on both the 2d frequency components of the image and the user specified quality level.

It is possible that down-scaling an image can increase the higher frequency components and potentially result in an increase in file size, typically higher frequency components a encoded using a higher number of bits compared to lower frequency components. An example would be to imagine shrinking a checkerboard texture, the smaller it gets the more it shifts into higher frequency.

It may also be possible that your original image was encoded with a low quality factor and your new image has a high quality factor so it can also gain extra bytes from that. On a more technical level this may be because of a mismatch in quantization bands leading to higher number of DCT coefficients being needed compared to the original JPEG. The quality parameter is not standardized and different applications have different ideas of what '90% quality' means.

Another problem is that because you are using JPEG as a source image it will introduce ringing artifacts into the image, which then need more bits to encode when trying to encode it.

Unfortunately there is no easy fix for this apart from reducing quality.

$\endgroup$
1
$\begingroup$

Your original image is very low in quality and talking with experance image with such dimension should have 3MB size but your file is already compressed using lossy data DCT algorithm, deflated upto 0.1 rate and had lost a lot of data before you download it!

In order to reduce the dimensions and preserving the filesize ratio, image editor program needs to extract the image and omit the lines vertically and horiznotally to reach to the desired dimensions and compress it again using a lossy data algorithm upto 10 percent but unfortunately this time the image will loose too much data and you will unable to recognize the faces in it. So you must select a higher quality cause the file just can not tolerate to loose any data again! This means you can not compress the extracted file as well as it was at first place.

Comparing JPEG encoding (after resizing the image ) with PNG which uses ZLIb algorithm(non lossy data) I believe you may recieve a better result if you save your altered dimension file in to PNG, the image has a lot of same color pixel that will let ZLIB to compress it very well. This is only true in case you have a file which is once compressed using JPEG.

$\endgroup$
2
  • 1
    $\begingroup$ There looks to be a number of rather odd things in your answer, but "Jpg uses fast fourier transform" is certainly incorrect. JPEG uses Discrete Cosine Transforms (DCTs). There are several reasons why this is a better choice than FFT but that's a little difficult to explain with limited time and the restrictions of S.O. comments :-). $\endgroup$
    – Simon F
    Commented Mar 9, 2017 at 9:57
  • 1
    $\begingroup$ @SimonF Thanks for your comment, I believe DCT is a special form of FFT since DCT only uses cosine waves but FFT uses both sine and cosine waves, you may set the sine expansion =0 and solve the equation using the constraint to have a DCT out of A FFT, but YES YOU ARE RIGHT the exact name of algorithm is DCT for jpeg lossy data. Thanks again $\endgroup$
    – Iman Nia
    Commented Mar 9, 2017 at 12:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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