Smaller image has same file size

Ask for help and post your question on how to use XnView Classic.

Moderators: XnTriq, helmut, xnview

Post Reply
Greg Martin

Smaller image has same file size

Post by Greg Martin »

When i resize a picture, the picture is smaller but file size is same.

Example: I resize 50% screen size (i have checked "Keep ratio") picture size is 373.92kb and after resize size is 376.24kb. Ok i do it again and now picture size is 104.27kb but picture is too small.

This picture is 72 pixels per inch but if my picture is 300, resize works great?

What here happen :?: :?: :?:
User avatar
helmut
Posts: 8705
Joined: Sun Oct 12, 2003 6:47 pm
Location: Frankfurt, Germany

Re: Smaller image has same file size

Post by helmut »

The phenomenom you observe might surprise other people, too:
You have a JPG image 600x400, resize it to 300x200, save it and the saved image is larger in size than the original image!

Reason for this is the lossy image compression of JPG: When saving an image in the JPEG format, one can set a quality level: 100% means, that the image is saved 100% exactly, no pixel will differ from the original when reopening the file. Any percentage less than 100% means that image information is lost due to the compression algorithm applied.

The compression algorithm can optimize best when it is applied the first time. Most JPEG images that one gets (from Internet, Digital cameras, Scanners) have been compressed with some loss, already.

Now, when resizing the image or even just saving it again, either the file is compressed again and image information is lost again, or the file size might remain almost the same, although the image is much smaller in pixel size.

The consequences:
- When saving an image with image loss (e.g. 50% JPG quality), image quality gets poorer each time the image is saved.
- If you intend to modify an image several times, do not use JPEG as intermediate format.

See also post "JPG LosslessTransformations"
Last edited by helmut on Tue Oct 10, 2006 12:10 am, edited 1 time in total.
Greg Martin

Post by Greg Martin »

Ok, thanks. Now i go first change in options-write-jpg-quality to 60% and now my photos' size come smaller when i use resize.

But i think it would be good if in resize window it was possible to change quality? Or maybe same like in Photoshop which after save asks what kind of quality you like.
crazytb
Posts: 124
Joined: Wed Oct 15, 2003 2:51 am
Contact:

Post by crazytb »

Resize proccess is totally independent of save proccess. You may resize a JPG picture and save it as BMP or PNG. If you choose BMP, there will be no "quality options". If you choose PNG, the "quality options" will be different from JPG ones.

So, I think these options should stay like they are now.
User avatar
helmut
Posts: 8705
Joined: Sun Oct 12, 2003 6:47 pm
Location: Frankfurt, Germany

Post by helmut »

Think the options should be displayed right before saving (as Greg proposed). With some formats like JPG and GIF, you often want to make a special setting per image:
For example in GIF files, you want to set the Transparent color and interlaced/non-interlaced. Making these settings in the general options or the colour dialog is too complicated and forgotten, often.
crazytb
Posts: 124
Joined: Wed Oct 15, 2003 2:51 am
Contact:

Post by crazytb »

Don't we have a button called "Options", just at side of "file type"? What is the problem with clicking there?
User avatar
helmut
Posts: 8705
Joined: Sun Oct 12, 2003 6:47 pm
Location: Frankfurt, Germany

Post by helmut »

crazytb wrote:Don't we have a button called "Options", just at side of "file type"? What is the problem with clicking there?
Right, there's the "Options" button in the "Save" dialog, this one is really helpful and directs to the appropriate options. But people might compress a file for the internet down to 30%. Two days later, they save another image and forget to change a setting and save their JPG image with that old 30% compression by accident.

To avoid this, showing a dialog with some options on it (e.g. quality for JPG files or transparency and GIF type for GIF files) could be helpful.
crazytb
Posts: 124
Joined: Wed Oct 15, 2003 2:51 am
Contact:

Post by crazytb »

I understand. So, if possible, would be a good idea to "extend" the save dialog to show the same options showed at Options dialogs.
User avatar
xnview
Author of XnView
Posts: 43603
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Post by xnview »

helmut wrote:To avoid this, showing a dialog with some options on it (e.g. quality for JPG files or transparency and GIF type for GIF files) could be helpful.
Yes, right. But the dialog will be so big :wink:
Pierre.
User avatar
helmut
Posts: 8705
Joined: Sun Oct 12, 2003 6:47 pm
Location: Frankfurt, Germany

Post by helmut »

xnview wrote:Yes, right. But the dialog will be so big
Sure enough, this should not be just one big save dialog, but more like a wizard, that means several dialogs or dialog pages after each other.
crazytb
Posts: 124
Joined: Wed Oct 15, 2003 2:51 am
Contact:

Post by crazytb »

helmut wrote:Sure enough, this should not be just one big save dialog, but more like a wizard, that means several dialogs or dialog pages after each other.
Wizard? Wizards aren't always good, because sometimes I cannot change all options at only one window. The first thing when I use WinZip is to select Classic style.

But... maybe... Add some small text area (just a label) to Save dialog, showing current quality settings for current image type, and a button to open a "normal" dialog to change these settings. This way, we will have the configuration at one click, and we will also have a "small" save dialog.
User avatar
helmut
Posts: 8705
Joined: Sun Oct 12, 2003 6:47 pm
Location: Frankfurt, Germany

Post by helmut »

Below a sample file which impressively shows how JPG compression can fail when re-saving a compressed JPG image:

Image saved with JPG compression (6 KB):
Image


Same image saved again with JPG compression (6 KB):
Image
User avatar
foxyshadis
Posts: 393
Joined: Sat Nov 18, 2006 8:57 am

Post by foxyshadis »

The second one has a thumbnail and some IPTC junk, it looks like; the actual image data is only 3.1k. Like most programs, I usually have to run a jpeg optimizing step after saving in xnview. :(
Post Reply