Solved

Converting BMP to GIF corrupts white background

Posted on 2011-02-23
8
569 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:stefanlennerbrant
  • 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 108

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:stefanlennerbrant
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
 
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:stefanlennerbrant
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 108

Accepted Solution

by:
Ray Paseur earned 500 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:stefanlennerbrant
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
I. Introduction In a previous article (http://www.experts-exchange.com/Web_Development/Document_Imaging/A_6537-PaperPort-Upgrade-How-to-download-and-install-updated-versions-of-PaperPort-11-and-12.html) (now deprecated), I discussed how to upgrad…
The goal of the tutorial is to teach the user how to edit a basic portrait of someone. This tutorial shows how to edit two basic photographs, one of a car and one of a person.
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.

762 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now