Re: Change ColorPalette
- From: "Bob Powell [MVP]" <bob@xxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 10 May 2006 20:02:24 +0200
See the GDI+ FAQ redarding transparent GIFS. This shows the technique.
In fact after a bitmap has been loaded with a certain palette the encoder
will ignore all new palettes and re-save with the original. The use of
lockbits and the copying of the existing GIF byte array data into the new
image permits the encoder to consider this as a fresh image so it will take
the new palette.
It's an annoyance of the IMO poorly written image encoder-decoder system.
Why they didn't do a pluggable system in there when it would have been so
simple to implement I'll never guess <sigh>
--
Bob Powell [MVP]
Visual C#, System.Drawing
Ramuseco Limited .NET consulting
http://www.ramuseco.com
Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm
Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm
All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
"César Chalom" <cchvfp@xxxxxxxxxx> wrote in message
news:%23lCZSA$cGHA.2188@xxxxxxxxxxxxxxxxxxxxxxx
Hello,
Is it possible to change the colorpalette of a GIF image without using
Lockbits ?
I'm doing the following :
1 - load any bitmap
2 - save as GIF (MS GDI+ saves using its default half tone palette)
3 - load this just created image
4 - retrieve the colorpalette
5 - change an entry, setting its ALPHA to 0 (zero)
6 - SetColorPalette to the just modified one
7 - Call Getpalette again, and check if it has the modified
8 Save as GIF
When I retrieve the just saved GIF, I get the original color Palette.
What am I doing wrong ?
AFAIK, lockbits should be used when there is the need to change some pixel
data, or am I wrong ?
TIA
Cesar
.
- Follow-Ups:
- Re: Change ColorPalette
- From: Cesar Ch
- Re: Change ColorPalette
- References:
- Change ColorPalette
- From: César Chalom
- Change ColorPalette
- Prev by Date: Re: Do I need to reinvent wheel ?
- Next by Date: Re: Multiframe Bitmap resolutions?!?!?
- Previous by thread: Change ColorPalette
- Next by thread: Re: Change ColorPalette
- Index(es):
Relevant Pages
|