Gif issue resolved :-)

A great thanks to Paul Nicholls who pointed me to the right solution. This is absolutely brilliant the way a community can work.

Apparently the culprit is GDI which use a web safe colours palette when you use image GIF format. Quite odd because this is way back to the time where users didn't have more than 256 colours from their graphics card.

I hope this can be solved in .Net 2. By the way does somebody know if we have to expect some new features in GDI+ 2.0 ?

Check this article on MSDN to know more about the solution which is to render a GIF image with a different palette. I choose the adaptive one (OctreeQuantization method) and it's perfectly fine.

The results of the quantization process are shown below.

Quantization TypeImageImage Size (in KB)

None (default GDI+)

21342

Palette-based

16748

Octree-based

16744

Figure 5. Comparison of quantization results

The palette and Octree results are 20 percent smaller than the default GDI+ rendering using a Web-safe palette, and the image quality is far superior. The palette- and Octree-based images are different because the images contained slightly differing text. Your results may vary based on the size of the image, but generating images that are smaller yet better has to be worthwhile.

 

2 Comments

  • Yes it helps, but still quite strange ths is not directly implemented in the api. Do you know if something like that has been improved in .Net 2 ?

  • It was a bit odd - and it took a little digging around to discover what the issue was when I ran into it.



    I couldn't see anything in the 2.0 beta SDK I have that mentions recolouring or quantizing, but there are quite a few incomplete areas.



    Hopefully your post will make it easier for people to find out about it. Even if they don't add the feature directly, it'd be nice if they mentioned it in the documentation.

Comments have been disabled for this content.