Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Converting BMP to GIF corrupts white background

Posted on 2011-02-23
8
Medium Priority
?
579 Views
Last Modified: 2012-06-27
I'm using PhotoFiltre (I tried both free version and payed Studio version) to batch convert a number of BMP screen dumps to GIF format
The GIF output may be selected as "maximum color count" or "256 colors". I tried both.
I don't do any changes in the picture (like size etc), but only "save as" the new format.

This tool PhotoFiltre is quite good at preserving palette information in conversions and keeps the colors very well.

The resulting GIF pictures look very good in color BUT the white background (there is a lot of background in the dumps) is slightly changed.
Instead of white RGB=FFFFFF I get FEFEFE or even F9F9F8
It seems like using the method "256 colors" is a little better, resulting in more FEFEFE backgrounds and not so much in F9F9F8.

This "corruption" differes from picture to picture (even though all pics have similar size and similar amount of background; however they of course differ in details)


I do understand the problem with optimizing palettes etc, but I didn't expect this problem when converting to "maximum color count"
And also I had hoped for the actual background (simple white FFFFFF) to be correctly converted.

Is this a limitation of PhotoFiltre, should I change to other tools?, or is this something that one always must count with in conversions?

/Stefan
bmp-with-ffffff.bmp
0
Comment
Question by:Stefan Lennerbrant
  • 3
  • 3
  • 2
8 Comments
 
LVL 26

Expert Comment

by:David Brugge
ID: 34966382
I'm afraid I don't have a solution for you, but can offer an explanation of why you are having this trouble.

The algorithm that is used to convert images to indexed-color images like GIFs varies a bit from product to product, but basically it tries to reduce to reduce the thousands or millions of collars that may appear in a BMP to the 256 (or fewer) colors of a GIF.

It mostly looks for colors that are in the majority, but on some occasions, where there are two similar colors in near equal proportions, it will "split the difference" and render a color that is in between both colors and make both colors a new single color.

It is likely that some  of your backgrounds are not pure FFFFFF, but are perhaps slightly darker in some areas, or there may be a lot of very light shadow that is throwing the color off.

You might try lightening the highlights very slightly before conversion. In such cases, the FFFFFF would remain the same, and the F9F9F8 would become FFFFFF as well.

 I do not speak French, so I could not read the documentation for PhotoFiltre, but I assume that there is a way to adjust the highlights without affecting the rest of the image.
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 34966431
Because BMP has potentially 16,000,000 colors (+/-) and GIF has 256 colors, some interpolation MUST occur.  Even a 100% white background may get darkened slightly.

In my experience, there is little advantage to GIF any more.  I prefer to use PNG files.  Since they support the full 8-bit RGB color palette you will not lose colors when you convert file formats.

In images where I have reduced the palette only to find that I have lost the true white background I have done the following.

1. Reduce the palette
2. Select the off-white color from area that was supposed to come out white
3. Increase the palette back to 16MM colors.
4. Select absolute white in the other side of the color replacer tool
5. Use the color replacer with a tolerance of zero to replace the off-white pixels with true white over the entire image
5. Reduce the palette again.

Et Voila!

Those directions work fine in PaintShopPro and Photoshop.  Hope it will work for PhotoFiltre, too.  Best of luck with it, ~Ray
0
 

Author Comment

by:Stefan Lennerbrant
ID: 34966479
Well the issue is that the original image (attached in the question) contains 147 colors
It is (for some reason) decreased to 82 by PhotoFiltre (I just checked that, didn't think of it before:-)

I do understand that such "optimizations" may take place, but it seems very odd that it will happen in this particular case?
Also, the GIF "many colors" is not using a palette, is it?, so that format should be able to handle all the 16M colors?

Also, of course all of this may be due to some limitations in the particular tool PhotoFiltre, but I do actually think that the tool "makes a good job" and that this problem may be more generic in some way?
And possibly there is a more generic solution to it?

Or is it just that I need to use another tool?

Can anyone convert that particular file to GIF without loosing colors? (I have about 350 images like that, so I need to automate the conversion; thus I need a tool and I cannot use any solution that requires any manual work)

/Stefan
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 26

Expert Comment

by:David Brugge
ID: 34966500
> Also, the GIF "many colors" is not using a palette, is it?, so that format should be able to handle all the 16M colors?

No. The GIF format only allows for a maximum of 256 colors.
0
 

Author Comment

by:Stefan Lennerbrant
ID: 34966701
Ok, then I suppose that "maximum color count" in Photofiltre, refers to setting the palette to the actual color count in the image?
However, 147 colors is still less than 256?

Thus, I suppose that this particular tool is "technically challenged" in some way, and cannot cope with the situation?
Or is there a "good reason" for not being able to fit 147 colors into the 256 palette?
As I said, the actual test image is attached above -- is it really "strange"?
0
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 2000 total points
ID: 34966763
I think you've got the right idea about Photofiltre being technically challenged.  I used PSP (an old copy) to reduce the BMP color palette to 256 colors, then saved the image as a PNG.  It is identical to the BMP, pixel-for-pixel, in its color rendering.  It has 147 colors.  But it is 5KB instead of 357KB.

You might want to consider Photoshop, PaintShopPro or GIMP.
png-with-ffffff.png
0
 
LVL 26

Expert Comment

by:David Brugge
ID: 34966848
Just for fun I took your image and converted it to GIF using the free program InfanView and it converted the background to #fcfefc.

I then converted it with the free program Gimp ( http://www.gimp.org/ ) and it held the background color as #ffffff. using the default settings.

You might want to try out Gimp.
0
 

Author Closing Comment

by:Stefan Lennerbrant
ID: 35106433
Sorry for being late (travelling)
Ok, fair enough. I'll go for those tools instead.
Good to hear that it's not a "real problem", but just a matter of different algorithms in different tools.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

PaperPort is a popular document imaging/management product from Nuance Communications (http://www.nuance.com/), previously known as ScanSoft. PaperPort is in widespread use by both individuals (http://www.nuance.com/for-individuals/by-product/paperp…
In a previously published article (http://www.experts-exchange.com/articles/10331/Automatic-Duplex-Scanning-in-PaperPort-Versions-11-12-14.html) here at Experts Exchange, I explained how to achieve duplex (double-sided) scanning in Nuance's PaperPor…
The goal of the tutorial is to teach the user how to make his/her own presets while editing so it is easier to edit there photos. Create a preset you like and copy that setting then save it in to your presets folder.
In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question