What format should I save this image in?

Frequently Asked Questions regarding XnView (including Answers)

Moderators: XnTriq, helmut, xnview

User avatar
Drahken
Posts: 884
Joined: Sun Apr 10, 2005 4:29 pm

What format should I save this image in?

Post by Drahken »

So you have an image and can't decide which format to save it in? Read on...

If your image looks like these:
Image Image Image Image

Then you should save them as 256 color PNGs or as GIFs (PNG is the better choice, but GIF will work).


If your image looks like these:
Image Image Image Image

Then you should save them as JPGs.


If your image looks like these:
Image Image LARGE PIC

Then it is difficult to decide. In most cases, JPG will work best. In the end though, you just have to try and see.


For any text on a solid background, first reduce the colors to 8 or 16 adaptive (even if you can only see 2 different colors, there may actually be more), then save as PNG.

For documents that contain both text and graphic images (like this one Image ), reduce it to 256 colors adaptive, then save as PNG.

Documents with text and photographs are difficult to choose a format for. Usually, using JPG with a quality setting of at least 85 will work well. There will be some quality loss, but it should be too noticeable. If the text is too fuzzy, try going to 95% quality.
You can also try reducing the image to 256 colors and saving as a PNG. This will make the photos not look as good, but the text will be very sharp.
Lastly, you can save as a full color PNG (simply save it as a PNG without reducing the colors first). This will result in an image with perfect quality on both the photos and text, but will also result in a large filesize.

It's almost always best to save photos as JPGs (high quality for ones you plan to keep or print, lower quality for ones you plan to post on the web). There is always some quality loss with JPGs, but it usually isn't noticeable, and the small filesizes more than make up for it.
If you plan to edit the photos often, or are extremely concerned with maintaining the quality, save them as full color PNGs or as JP2s. Both are completely lossless, but produce large files (as do all lossless formats). JP2s are somewhat smaller than full color PNGs, but not as many programs can handle them.



Be sure to check out my related FAQS: Common image formats ... Lossy vs lossless vs color reduction


If you have a an improvement suggestion for this (or any of my other FAQs), or an additional question you think should be added, feel free to message me.
Bruce
Posts: 2
Joined: Sun Apr 19, 2009 11:28 pm

Re: What format should I save this image in?

Post by Bruce »

I function mostly as an archivist and for that I like TIF. It is popular enough that I am pretty sure it will be around in 50 years. Also by using IPTC I can lodge explanations and comments which become an integral part of the file. As such it will explain much to those who, I hope, are looking at the photos years after I am gone. I have tried PNG, but not all programs will accept it and I found the files to be slightly larger than TIF with LZW compression, so I stayed with TIF.
eL_PuSHeR
Posts: 267
Joined: Sat Apr 25, 2009 9:23 am

Re: What format should I save this image in?

Post by eL_PuSHeR »

For text and images/photos bitmaps is also a good idea to reduce colours to 15bpp. Thus, you get crisp text, almost true colour quality photos (using an error-diffusion algorithm) and they can be compressed almost as good as 256 colours PNGs.

I do not use JPEG anymore (save for true photographs without text). I have move to lossless compression.
Intel i7 5960X
Gigabye GA-X99-Gaming 5
8 GB DDR4 (2100)
GeForce GTX 970 (Gigabyte)
User avatar
Drahken
Posts: 884
Joined: Sun Apr 10, 2005 4:29 pm

Re: What format should I save this image in?

Post by Drahken »

bruce- Unless you are talking about 48 or 64bpp pngs, I have never seen any prog which can't handle pngs. Hell even internet explorer finally supports pngs with alpha transparency.
Also, (with the possible exception of the aforementioned 48/64bpp pngs, which I have no experience with) if you are truly getting better sizes with tiff than png, then your imaging software either has crappy png support or amazing tiff support. In every single imaging prog I've ever tried, png is always smaller than tiff (regardless what settings I use).
For archiving purposes, tiff probably is a better choice. It was after all designed for such use, while png on the other hand was primarily designed for web use. This tutorial was also originally written primarily for web use, which is why I focused on jpg/png/gif.


A note about jpgs: If you disable chroma subsampling (you can do this in xnview by going to the jpeg settings & choosing 1x1,1x1,1x1 from the dropdown box), you can eliminate the washed out colors effect that you so often see in jpegs, and make it look almost as good as a png at a much smaller filesize. Compare these 2 pics for example:
Image
Image

Especially look at "drahken" and the colored boxes on the left. The top image uses the lowest quality subsampling (2x2, 1x1, 1x1), while the bottom one uses no subsampling.
Oh the feuhrer, oh the feuhrer, oh the feuhrer's nipples bonk!
eL_PuSHeR
Posts: 267
Joined: Sat Apr 25, 2009 9:23 am

Re: What format should I save this image in?

Post by eL_PuSHeR »

There is noticeable artifacting due to JPEG compression around text when zoomed in. This is the results of compressing to PNG using 24, 15 and 8 bits per pixel.

Too bad the comparison isn't fair because I used the JPEG as source. Note that there isn't even very great differences when using True colour or less and the 15bpp one has got an acceptable size while the 256c one is even smaller than JPEG. I bet the original image would compress even better.

Image

Image

Image
Intel i7 5960X
Gigabye GA-X99-Gaming 5
8 GB DDR4 (2100)
GeForce GTX 970 (Gigabyte)
User avatar
Drahken
Posts: 884
Joined: Sun Apr 10, 2005 4:29 pm

Re: What format should I save this image in?

Post by Drahken »

Of course, there will always be jpg artifacting when using anything less than lossless jpg (which very few progs support). My point was that the crappy looking colors (which are glaringly obvious, even when not zoomed in) can be avoided.

If you want something to test around with, here's a png version. The background image in it was originally a jpg, but the text & such has never been saved as jpg, so there are no artifacts in it:
Image
Oh the feuhrer, oh the feuhrer, oh the feuhrer's nipples bonk!
eL_PuSHeR
Posts: 267
Joined: Sat Apr 25, 2009 9:23 am

Re: What format should I save this image in?

Post by eL_PuSHeR »

Ok. This is how it turned out.

Compressing it lossly using JPEG with just 10 percent compression ratio and Chroma subsampling 1x 1x 1x gives an output almost identical to original save some noticeable artifacts (even at this low compression ratio). Size is 46.054 bytes.

24bpp image has got 33.398 colours
15bpp image has got 4.020 colours
8bpp image has got 252 colours

I have chosen an "optimized octree" method for choosing palette with no dithering (nearest colour) to avoid "bleeding".

24bpp image is 109.664 bytes in size.
15bpp image is 54.458 bytes in size. (65.314 bytes when dithered with error-diffusion).
8bpp image is 26.883 bytes in size. (32.400 bytes when dithered with error-diffusion).

No great visual differences between non-dithered and dithered counterparts for this type of image. Here they are.

Image

Image

Image

Image

Bottom line: As images grow bigger so does the gap between lossy and lossless compression. If you want utmost quality stick with lossless. Keep in mind also that compression ratios depend heavily on image content too. Obviously, line art images would compress great while photographs will get poorer compression ratios.
User avatar
Drahken
Posts: 884
Joined: Sun Apr 10, 2005 4:29 pm

Re: What format should I save this image in?

Post by Drahken »

ImageAnalyzer has a "lossy" png function which can often reduce the size of a png greatly. At low levels it can be hard to see the difference unless you have the original to compare with, but if you can directly compare the 2 then the difference becomes quite visible.
(The program still saves a normal, lossless, png, but it performs a lossy transformation just before saving. The concept is similar to reducing the colors of an image before saving.)

At a low setting visual quality is largely maintained & the size is cut almost in half (down to 69K):
Image

At it's highest setting the image is down to only 31K, but the quality loss become very blatant (it does give an idea of just what this lossy filter does though):
Image
Oh the feuhrer, oh the feuhrer, oh the feuhrer's nipples bonk!
eL_PuSHeR
Posts: 267
Joined: Sat Apr 25, 2009 9:23 am

Re: What format should I save this image in?

Post by eL_PuSHeR »

I prefer to do my own lossy optimization, mostly reducing number of colours.
Intel i7 5960X
Gigabye GA-X99-Gaming 5
8 GB DDR4 (2100)
GeForce GTX 970 (Gigabyte)
Puenktchen
Posts: 1
Joined: Sun Jul 28, 2019 1:28 am

Re: What format should I save this image in?

Post by Puenktchen »

Which format will have the best results including 16bit color?
I do import RAW files in lightroom/caputure one.
I dont wont to export to SRGB jpeg (8 bit).
I could go for tiff ProPhoto RGB (16bit) *1
or JPEG XR adobeRGB (16bit)
or JPEG2000 adobeRGB (16bit)

which one will work best with XnView?

Thanx for your help...

Puenktchen

*1 XnView will convert this to 8bit while loading the picture? Am I doing somthing wrong? (like to have 16bit)
User avatar
Stock
Posts: 34
Joined: Wed Oct 12, 2022 3:33 pm

Re: What format should I save this image in?

Post by Stock »

I'd suggest...
782sws.jpg
You do not have the required permissions to view the files attached to this post.