Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Converting BMP to GIF corrupts white background

Posted on 2011-02-23
Medium Priority
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?

Question by:stefanlennerbrant
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
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.
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

Author Comment

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)

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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.

Author Comment

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"?
LVL 111

Accepted Solution

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.
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 ( ) and it held the background color as #ffffff. using the default settings.

You might want to try out Gimp.

Author Closing Comment

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.

Featured Post

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.

Question has a verified solution.

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

This article discusses the PaperPort 14 Scanner Connection Tool, which Nuance provides at no charge in order to fix scanning problems in Windows 8. Furthermore, users of PaperPort 14 in Windows 7 and Windows 10 have reported that the tool works in t…
PaperPort 14.5 Patch 1 update is often not detected or downloaded automatically. This article provides direct download links to solve the problem for retail (non-bundled) versions of the Standard and Professional editions, as well as the Professiona…
The goal of the tutorial is to teach the user how to use import presets downloaded from the internet into Adobe Lightroom. Once you downloaded the presets go into the preset folder and press import then import your preset and your set it to go.
The goal of the tutorial is to teach the user how to remove a natural vignette your photos and how to add vignette to your photos.
Suggested Courses

664 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