GIF format not lossless?

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

Moderators: helmut, XnTriq, xnview

Guest

GIF format not lossless?

Post by Guest »

<Moderator's note: This post was split from topic 'PNGout'>

I thought Gif was lossless. Although, Save As dialog box for Gif does say "Save as - colour mode".

The TrueColor button in that dialog box is greyed out. There are options for Binary, Grey scale, and Colour. The default is 8 color. I always choose 256 color. Is this not a good choice? Is this lossy or lossless? What XnView choices would give you a lossless Gif if this is lossy?
User avatar
helmut
Posts: 8704
Joined: Sun Oct 12, 2003 6:47 pm
Location: Frankfurt, Germany

Post by helmut »

Anonymous wrote:I thought Gif was lossless. Although, Save As dialog box for Gif does say "Save as - colour mode".

The TrueColor button in that dialog box is greyed out. There are options for Binary, Grey scale, and Colour. The default is 8 color. I always choose 256 color. Is this not a good choice? Is this lossy or lossless? What XnView choices would give you a lossless Gif if this is lossy?
Regarding the image contents (details), GIF is lossless. But GIF supports 256 different RGB colours, only. So if you have a colourful image with many different colours and convert it to GIF, you will loose colours. So if you want to be exact, GIF is not really fully lossless.
User avatar
Drahken
Posts: 884
Joined: Sun Apr 10, 2005 4:29 pm

Post by Drahken »

See THIS thread for more info on GIFs and PNGs and other formats. Near the bottom explains about lossy vs lossless.

Gifs are a lossless format, no information is thrown away when you save the image (whereas lossy formats such as jpg throw away some info every time you save the image). However, gif is limited to a maximum of 256 colors. If your image has more colors, it will be reduced to 256 or less when you save it. (This is the only type of data that is lost, and it only occurs if your image has more than 256 colors. If you then open that image later and resave it, no further data will be lost.)
How many colors you choose and whether or not you want it dithered depends on whether you prefer size or quality. Fewer color=smaller size, but can make for a crappier looking image. Also, you should reduce the colors of your image BEFORE saving (if you're saving as a gif or as an indexed PNG), this gives you more control, and lets you see what the image will look like with fewer colors. To do this, go image->convert to colors and pick an option.

About adaptive vs dithered: Lets say you have a spot of medium red in your image, but the only colors available with the number of colors you chose are light red and dark red. If you choose adaptive, the medium red will be replace with either the light red or the dark red. If you choose dithered, the medium red will be replace with light red dots mixed with medium red dots in such a way that it will appear medium red from a distance.

For more info on when to use gifs, read the thread I linked to earlier. If your image is a photographic type one, you do not want to use gif, the measly 256 colors available will make it look like crap (as well as giving it a huge filesize). For such images, you want either jpg or png.
For images with large chunks of solid color, and sharp crisp edges, gif is a good choice (although png is better).
If you want a truly lossless image, I would recommend PNG. PNG can be used anywhere you can use a gif, and it has the capacity to have more than 256 colors.
User avatar
helmut
Posts: 8704
Joined: Sun Oct 12, 2003 6:47 pm
Location: Frankfurt, Germany

Post by helmut »

Drahken wrote:... If you want a truly lossless image, I would recommend PNG. PNG can be used anywhere you can use a gif, and it has the capacity to have more than 256 colors.
Thank you Drahken, for another excellent explanation. :-) Perhaps we add the limitation of 256 RGB colours in the topic "Common graphic formats".
User avatar
Drahken
Posts: 884
Joined: Sun Apr 10, 2005 4:29 pm

Post by Drahken »

Actually, I was just thinking of making another FAQ about lossy vs lossless and color limitations. There's a lot of ground to conver on the subject, and I think it would work best as a seperate FAQ.
User avatar
helmut
Posts: 8704
Joined: Sun Oct 12, 2003 6:47 pm
Location: Frankfurt, Germany

Post by helmut »

Drahken wrote:Actually, I was just thinking of making another FAQ about lossy vs lossless and color limitations. There's a lot of ground to conver on the subject, and I think it would work best as a seperate FAQ.
Good point. Actually when reading the Common graphic formats, it's a bit "dry". I think often people haev an image and don't know which graphic format they should use. Especially when preparing images for the web or e-mail. So another FAQ (or several ones) which works the other way round could be helpful: User has image A and therefor graphic format B. Just an idea...
Guest

Post by Guest »

Yes, there need to be more clarification in Common Graphic Formats. I read already that before posting here. That the reason for posting here. It not clear enough.

Format into XnView (input)

Documents from Camera
- Start as JPG (only one the camera support)
- you have to convert to whatever format from JPG starting point

Documents from Scanner
- Start as any format XnView can support, usually start with PNG, then convert from that. Other times start as GIF. Depend on file and how much color or graphic in it.
- PNG often way too large, GIF usually very small, but sometimes colors in Gif very bad. Also it better to use XnView application for conversion because you get more save options for GIF and other formats. Using context menu conversion, GIF automatically saved in 8 color format (no choice), not sure whether PNG TrueColor or Indexed format is used in XnView app and XnShellEx context.

Documents from Internet or Saved Files
- Jpg, Gif or PNg usually
- sometime bmp, text, html, mht, or eml.

Format out of XnView: (output)

Need you to tell me best graphic format (best readability but smallest file size) for archiving each of following (save disk space)...

Plain text on white or light background (black&white, gray scale, faxes)
Colored text on white or light background (bills, checks, letters)
Colored text on dark or colored background (checks, letters, ads)
Plain or colored text with graphics or logo (letterhead, simple brochures)
Mixed text with very small print & some color (utility & credit card bills)
Document with lots of color and graphics (full color brochures)
Document with photographs
Photographs only
Icons for Windows

More question to be added later. Forgive poor english.
User avatar
Drahken
Posts: 884
Joined: Sun Apr 10, 2005 4:29 pm

Post by Drahken »

1) If you don't reduce the colors beforehand, Xnview will save it as a true color PNG (this also explains the large size. Truecolor PNGs make pretty large files, but are absolutely lossles, and are the second smallest lossless format. JP2 is the smallest.)
2) 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.
3) For documents that contain both text and graphics (like this one Image ), reduce it to 256 colors adaptive, then save as PNG.
4) 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.
5) 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.
6) In order for windows to use them, icons have to be in ICO format (or at least BMP), there is no option.
User avatar
SeaMaiden
Posts: 65
Joined: Tue Aug 17, 2004 8:36 am
Location: Fresno, CA, USA
Contact:

Post by SeaMaiden »

Welcome, Guest

Do not worry about poor English. We understand your message. You might consider registering so you can edit your posts and easily find your posts later.

I agree that the Common Graphic Formats FAQ needs to be edited and include more information. I also understand the dilemma of determining the proper graphic format for saving a particular document.

Sometimes it's trial and error. I use GIF, JPG or PNG for most scanned documents that you mentioned: letters, utility and credit card bills, bank statements, invoices, receipts, brochures. Some of those have medium print, other have very small fine print, and some have more color and graphics than others. Since you lose something with JPG, if it's a file I might edit often, I make a backup JPG copy or backup PNG copy. That way there is always a good original should the other one become too lossy or corrupted, or if your image editing goes awry.

My digital camera is also limited to JPG only and, like you, I have to convert to other formats from that. Scanned documents often have more than one page, one scan (file) per page.

It is always a challenge getting the fine print to be readable and still have a small file size when scanning bills and credit card statements. That fine print is often very important. I usually convert a file to several different formats and see which one looks best and which has smallest file size, choose the best one and delete the others. Sometimes I save different pages in GIF and others in PNG. There is no rule that says all pages of the same document must be the same file format.

When the document is multiple pages, I also compress the files with WinZip, WinRar, and 7-Zip to see which one of them can compress them the smallest. I keep the smallest and delete the others.

---

Drahken, please explain the procedure for reducing colors in your answers 1, 2 and 3. Let's say I'm starting with a JPG. What do I do to reduce the colors and the adaptive option you mentioned before saving the file as PNG or JP2?

There is only one PNG format in XnView (Associations, File types, and Save as). Is XnView's PNG TrueColour or Indexed?

There are multiple JP2 formats. What's the difference?
1. jp2 (LuraWave JPEG-2000 File Format / JPEG-2000 JP2 File Format)
2. jpf (LuraWave JPEG-2000 File Format / JPEG-2000 JP2 File Format)
3. jpc (LuraWave JPEG-2000 Code Stream / JPEG-2000 Code Stream)
4. jpx (LuraWave JPEG-2000 File Format / JPEG-2000 JP2 File Format)
Windows 11 (64-bit), Android 12, XnViewMP 1.5.0, XnResize 1.10, XnShell 4.16
** XnView ROCKS **
User avatar
Drahken
Posts: 884
Joined: Sun Apr 10, 2005 4:29 pm

Post by Drahken »

As I stated in an earlier post in this thread
To do this, go image->convert to colors and pick an option.
Simply open the image in Xnview, click the "image" option at the top, go to "convert to colors" and then choose an option. The menu is divided into 2 sections, the top section is adaptive, the bottom is dithered (each option says "8 colors (adapative)", "32 colors (dithered)", etc).
For documents that are black& white or shades of grey, you can use the "convert to greyscale" option instead of "convert to colors" (everything else is the same). The "convert to binary" option could be used on black & white images, but will usually give poor results. The reason for this is that while certain images appear to only have 2 colors, they often contain more. Reducing them to binary (black & white) will usually result in very jagged looking text.


If you reduce colors before saving (so that you don't wind up with true color PNGs), there's really no point in using GIF for any documents. GIF is only good for animated images, or very tiny ones. a PNG with 256 colors or less will be smaller than a GIF. For black&white or greyscale documents, you can also reduce to greyscale for PNGs.


SeaMaiden
I agree that the Common Graphic Formats FAQ needs to be edited and include more information.

Guest
Yes, there need to be more clarification in Common Graphic Formats.
Such as...?
I'm perfectly willing to edit/ad to my FAQs, but I'm not a mind reader. If there's something you think is missing, or something that needs clarified more, let me know what and I'll see if I can fix it.
Also, I just added 2 new FAQs, one about lossy/lossless/color reduction and one about choosing the right format for your image.


Edit:
Xnview has both truecolor and indexed PNGs, it all depends on whether or not you reduce colors before saving. If the image has more that 256 colors at the time you save it, Xnview will save it as truecolor. If you've reduced it to 256 colors or less (greyscale also counts as 256 or less in Xnview, but not always in other progs. In other progs, greyscale is usually between truecolor and indexed), Xnview will save it as indexed.

The jpf, jpx, and jpc formats are rare. The exact difference between them and regular JP2 is a technological issue, not something a normal person would ever notice (which is why I didn't specifically state anything about them, they're simply beneath notice ;) ). Be aware though, that very few programs can handle those other formats. JP2 is the only one you want to bother with.
Hacker
Posts: 242
Joined: Tue May 17, 2005 9:24 pm
Location: Bratislava, Slovakia
Contact:

Drahken

Post by Hacker »

Truecolor PNGs make pretty large files, but are absolutely lossles, and are the second smallest lossless format. JP2 is the smallest.)
BMF is the smallest. ;)

Roman
Guest

Post by Guest »

This thread here answered several of my questions about the Common Graphics Format thread. GIF is lossless, except for the 256-color limit. That part should be included. Both types of PNG are lossless. Reducing colors and why should be incorporated. I'm working on a list of other things. Give me a few days.

I hope in that new FAQ you wrote about choosing the right format for your document you covered something about scanning size and resolution. Sometimes you have to decide whether to scan at 100% (8.5x11) with 100-150dpi or 25-35% with 600-900dpi. You can't scan at 100% (8.5x11) at 900-1200dpi because the scanner will give you an error the file is too large in pixels. My scanner uses 24-bit color, but maybe some newer models have 48-bit color or better. You have to balance file size with file quality. It is probably the same with digital cameras. Stuff like that should be covered.
User avatar
SeaMaiden
Posts: 65
Joined: Tue Aug 17, 2004 8:36 am
Location: Fresno, CA, USA
Contact:

Post by SeaMaiden »

That last post was mine. I forgot to log in.

Let me point out to the Guest who started this thread that XnView cannot accept text files as input. Maybe it can with some type of plugin, but I just tried it and got an error. When using html, mht, and eml as input, the resolution and quality is very poor. You can't even zoom to 100% before it gets distorted and unreadable. XnView was not designed for those formats. You wouldn't be able to input them at all without the Xhtml plugin, and its purpose is preview/thumbnail rather than image editing.

BMF = Corel Flow (preview) | BMF

XnView can read BMF but cannot write it. You would probably need a Corel-based application like Corel Draw or Paint Shop Pro to create and edit those files.
Windows 11 (64-bit), Android 12, XnViewMP 1.5.0, XnResize 1.10, XnShell 4.16
** XnView ROCKS **
Hacker
Posts: 242
Joined: Tue May 17, 2005 9:24 pm
Location: Bratislava, Slovakia
Contact:

Post by Hacker »

SeaMaiden,
You would probably need a Corel-based application like Corel Draw or Paint Shop Pro to create and edit those files.
No, this is a standalone program - http://www.compression.ru/ds/

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

Post by Drahken »

Never heard of BMF files before.

The GIF being lossless part is covered in the lossy/lossless/color reduction FAQ, although I guess it could use some more details about how to reduce colors in Xnview, and why you would want to reduce colors.

I don't do much scanning myself. However, I can tell you that it makes no real difference whether you scan at high % of size and low DPI, or low % of size and high DPI, in both cases you will wind up with the same image. The DPI only takes effect when you print an image, and it can be changed at any time after you've scanned and saved the image.

There is a plugin posted somewhere that lets Xnview read txt files. Also, some other progs can read txt files and save them as images.
Post Reply