How to reduce an image's file size?

Frequently Asked Questions regarding XnView (including Answers)

Moderators: XnTriq, helmut, xnview

Post Reply
User avatar
helmut
Posts: 8705
Joined: Sun Oct 12, 2003 6:47 pm
Location: Frankfurt, Germany

How to reduce an image's file size?

Post by helmut »

For sending out image via e-mail or when saving an edited image you want to get an image with smaller or reasonable file size. Below please find a list of various approaches to reduce an image's file size.


Any graphic program that can save an image can reduce it's filesize. Some ways to reduce the filesize include:

a. Use a different format
Lossless formats like TIFF or BMP are inherantly large, switching to JPEG will greatly decrease the filesize of photographic images.

b. Choose a higher compression level.
If you're using a lossless format and already at the highest compression, you'll have to use a different method. Compression level can be set by clicking the "options" button when you go to save an image.

c. Reduce the dimensions of the image
By cropping or reducing an image, you will reduce the amount of pixels and graphic data in the file. This in turn will reduce the filesize.

d. Reduce the colors of the image.
If you reduce the image to 256 colors or less, or convert it to greyscale, that will again reduce the data and therefore the filesize.

e. Blur the image
You can reduce the size of a photo in JPEG format by blurring or softening the image.

XnView's Export function
The easiest way to get an image at a low filesize and still keep it at an acceptable quality (nearly anything that will reduce the filesize will have an impact on quality (although often it isn't a noticeable one), it's simply an unavoidable fact) is to use the export function of XnView. This will allow you to see the results of using a different format, higher compression, and reducing colors before you actually save the image (cropping and blurring still have to be done before exporting though).

Note:
All the above info has been originally posted by Drahken in topic Can you shrink a picture file size?. Thank you, Drahken!


Related topics:
- 'Lossy? Lossless? 256 colors? This is confusing!'
- How to prepare an image for the internet
- How to Batch convert several images at once
- Smaller image has same file size
- Resizing image results in larger file
- What format should I save this image in?
- Common graphic formats
User avatar
DOS386
Posts: 291
Joined: Sun Jun 11, 2006 2:43 pm

Re: How to reduce an image's file size?

Post by DOS386 »

helmut wrote:a. Use a different format
Lossless formats like TIFF or BMP are inherently large
It's not only because of "lossless", rather that both BMP and TIFF do have compression, but is rarely used, also RLE algo of BMP is not very efficient.
b.
c. Reduce the dimensions of the image
File size is proportional to image area ... in average ... special content can violate this rule http://newsgroup.xnview.com/viewtopic.php?t=1253
d.
e.
f. Use PNG format instead of GIF

g. Use a PNG optimizer (PNGOUT, OptiPNG, DeflOPT)
Last edited by DOS386 on Sun Jun 13, 2010 12:35 am, edited 1 time in total.
There is indeed no WinZIP under my rock.
Aokromes
Posts: 204
Joined: Wed Oct 22, 2003 3:40 am
Location: Vitoria-Gasteiz Beyond Stargate Network ;)

Post by Aokromes »

You forgot the "Use a external compresor" like zip, rar, 7zip etc.
User avatar
Drahken
Posts: 884
Joined: Sun Apr 10, 2005 4:29 pm

Post by Drahken »

A very large portion of the massive filesize of a lossless format IS the fact that it's lossless. Compress a photograph losslessly with any format & settings you want (jpeg2000 is usually the best), it'll still be several times the size of a lossy format of similar visual quality.
TIFF compression is almost always used, uncompressed TIFFs are extremely rare. BMPs almost never use any compression, the RLE compression can only be used on indexed BMPs (and even when it is used, it's not remotely efficient, which is why BMPs are about the worst format you can use. Ever.)

The only time GIF should ever be chosen over PNG is if you want animation. Other than that, PNG is much better on every level.
User avatar
DOS386
Posts: 291
Joined: Sun Jun 11, 2006 2:43 pm

Post by DOS386 »

Aokromes wrote:You forgot the "Use a external compresor" like zip, rar, 7zip etc.
This fails in 99% of cases ... because PNG is better than ZIP ;-)

In 1%, when having many large and similar screenshots for example, putting them as BMP's (! not PNG's) in 1 (! no bunch) solid (!) 7-ZIP (! ZIP is a no-go) can be ways better than a bunch of PNG's :-)

I wrote:
rather that both BMP and TIFF do have compression, but is rarely used
Drahken wrote:
TIFF compression is almost always used, uncompressed TIFFs are extremely rare.
Interesting negation ... but did you ever look / test ?

Image

Code: Select all

*******************************

480x320x24bpp TrueColor

BU.BMP 460'854  
BU.TIF 461'560 Default NC/XN 
BU.TIF 149'563 LZW-Pre lossless 
BU.PNG 118'630 PNGOUT 

*******************************
You can see 2 things:

1. NCONVERT and XNVIEW (like most others) save TIFF by default as uncompressed (even bigger than BMP) :shock:

2. PNG is ways better than any of TIFF's lossless methods
BMPs are about the worst format you can use. Ever.
BMP is very simple and very compatible ... very good for temporary storage ... and very bad for long term storage or uploading.
Last edited by DOS386 on Sat May 08, 2010 6:37 am, edited 1 time in total.
There is indeed no WinZIP under my rock.
User avatar
RGBA
Posts: 45
Joined: Fri Jul 18, 2008 10:41 am

Post by RGBA »

@DOS386
TIFF can handle Meta Infos (EXIF, IPTC, XMP), as well as JPG.
BMP has no ability for this.

Related to PNG: it supports also Meta Infos,
but doesn't follows neither IPTC- nor Exif-specs.

146.313 TGA (RLE)
135.201 TIFF (ZIP)
119.842 PNG (9, Filter all)
118.832 PNG (optipng -o7)

If you are only interested in low size just resample the pic and take GIF.
Color: Floyd or adapt., because there is no visible difference and your result is already under 100KB.

My fav. PNG recompression tools are currently:
http://www.vbgore.com/PNG_Monster
or
http://psydk.org/PngOptimizer
The second one is pretty good, because its looks automatic in subfolders and is fine for portable usage.
XnView 1.95.3 de | XP Prof. SP3
georgesg
Posts: 1
Joined: Mon Apr 12, 2010 7:41 pm

Re: How to reduce an image's file size?

Post by georgesg »

In the french version, the window "resize" proposes 3 options for finalizing the resizing: "charger", "enregistrer", "exporter" in french, that is "load", "save", "export" in english.
How to use these buttons, what do they do?
Thanks for explaining in detail..... georges :?
User avatar
Drahken
Posts: 884
Joined: Sun Apr 10, 2005 4:29 pm

Re: How to reduce an image's file size?

Post by Drahken »

The only thing I can find with load/save/convert in the english version is the batch & sequence convert. In both of these cases the load/save/export only applies to conversion scripts (save saves changes to the existing script, load loads a new script, export saves settings to a new script). If this is the dialog you are looking at, then you should see "go" and "cancel" at the bottom of the window, "go" is what you want to click.
The normal resize option (should be located under image->resize, or by hitting shift+s) only has go & cancel.

The batch convert dialog:
Image


The normal resize dialog:
Image
Oh the feuhrer, oh the feuhrer, oh the feuhrer's nipples bonk!
visionhelp
Posts: 23
Joined: Mon Jan 09, 2017 5:42 pm

Re: How to reduce an image's file size?

Post by visionhelp »

What about "Canvas Resize" ? I never tried.

Coming from my question from my topic here
"1.96.5, pic resize does not reduce the file size, in the opposite" http://newsgroup.xnview.com/viewtopic.php?f=35&t=35528
User avatar
helmut
Posts: 8705
Joined: Sun Oct 12, 2003 6:47 pm
Location: Frankfurt, Germany

Re: How to reduce an image's file size?

Post by helmut »

visionhelp wrote:What about "Canvas Resize" ? I never tried. ...
Thank you for your question, visionhelp. Here, ways of reducing file size while keeping the image's contents close to the original image are discussed. With "Canvas resize" you resize the canvas without adjusting the image's size. This means that canvas resize is actually a way of cropping an image (assuming that you reduce canvas size) .
cday
XnThusiast
Posts: 3973
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: How to reduce an image's file size?

Post by cday »

To add to Helmut's reply above:

Canvas resize... provides a way of changing the canvas size of an image: common uses are to add canvas of a specified colour (the 'background colour'), for example to add a border around an image, to add canvas below an image on which to place a caption, or to add canvas to change the aspect ratio (ratio of width to height) of the image. If your interest is in reducing the file size of images, then it has no obvious relevance.

If some of your smaller files increase in size when the pixel dimensions are reduced, the likely reason is that they were compressed at a significantly higher compression setting than the setting you used when you saved the redimensioned images.
gendalf
Posts: 65
Joined: Thu Aug 04, 2011 1:26 pm

Re: How to reduce an image's file size?

Post by gendalf »

It would really be useful to have an option for the condition: if "new filesize > old filesize" then "no action"; to the batch convert (Ctrl-U).
When you're trying to batch-compress hundreds or thousands of images, you don't really want to check every one of them.
Post Reply