Converting BMP to GIF corrupts white background

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 LennerbrantAsked:
Who is Participating?
Ray PaseurCommented:
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.
David BruggeCommented:
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.
Ray PaseurCommented:
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
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

Stefan LennerbrantAuthor Commented:
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)

David BruggeCommented:
> 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.
Stefan LennerbrantAuthor Commented:
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"?
David BruggeCommented:
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 ( ) and it held the background color as #ffffff. using the default settings.

You might want to try out Gimp.
Stefan LennerbrantAuthor Commented:
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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.