PDA

View Full Version : QImage save images with different sizes of original images



vcp
24th July 2009, 19:08
Hi,

I need help to the understand this:

Why QImage save a JPEG image with a different size of source file?

See:

QImage img("source.jpg"); // size 1.3MB (1.352.640 )
img.save("target.jpg,"JPG"); // size 374KB :confused:

Why this occours? How I do to save with same size?

Thanks in advance.

Lykurg
24th July 2009, 19:29
Hi, I guess the images are saved with different quality settings try

img.save("target.jpg,"JPG", 100);

vcp
24th July 2009, 19:49
So Lykurg ...

If I save with quality = 100% the size up to 2.1MB. With 50% down to 231KB.

If I use img.quality() (QImageReader) the result is ever -1.

See this results:

Source: 1.352.640 img_0070.jpg

Size Quailty
82.066 0%_img.jpg
102.329 10%_img.jpg
135.576 20%_img.jpg
171.828 30%_img.jpg
205.944 40%_img.jpg
242.294 50%_img.jpg
282.935 60%_img.jpg
347.967 70%_img.jpg
461.758 80%_img.jpg
779.266 90%_img.jpg
2.194.091 100%_img.jpg

wysota
24th July 2009, 23:02
It is not possible to determine the quality of an already saved jpeg image - you never know how many terms from the cosine transformation have been cut of while saving.

vcp
27th July 2009, 16:45
Hi Wysota,

Now, I understood

Thanks