From: David Ching on
"Peter Olcott" <NoSpam(a)OCR4Screen.com> wrote in message
news:meydnSP6GJvfGRPWnZ2dnUVZ_jSdnZ2d(a)giganews.com...
>
> The original
> RGB(255, 0, 0)
> RGB(0, 255, 0)
> RGB(0, 0, 255)
>
> becomes
> RGB(253, 0, 0)
> RGB(0, 251, 0)
> RGB(0, 0, 252)
>
> How can I get Windows to quit screwing this up? The problem is that for
> legacy reasons it wants to make sure that certain colors are available
> even if they are not needed. It apparently keeps at least 20 colors for
> itself, thus merging the colors you specify if it needs to make room for
> its colors.

The business about reserving 20 colors for itself is only true if your
display resolution is set to 256 colors. It involves palettes which are not
used when your display is set to either 16/24/32 bit color which is almost
always true these days. Show your code you use to display this, and also
tell how you are determining the real color of the pixel that you say is
wrong.

-- David


From: Peter Olcott on

"David Ching" <dc(a)remove-this.dcsoft.com> wrote in message
news:eG3K5GvuKHA.5036(a)TK2MSFTNGP02.phx.gbl...
> "Peter Olcott" <NoSpam(a)OCR4Screen.com> wrote in message
> news:meydnSP6GJvfGRPWnZ2dnUVZ_jSdnZ2d(a)giganews.com...
>>
>> The original
>> RGB(255, 0, 0)
>> RGB(0, 255, 0)
>> RGB(0, 0, 255)
>>
>> becomes
>> RGB(253, 0, 0)
>> RGB(0, 251, 0)
>> RGB(0, 0, 252)
>>
>> How can I get Windows to quit screwing this up? The
>> problem is that for legacy reasons it wants to make sure
>> that certain colors are available even if they are not
>> needed. It apparently keeps at least 20 colors for
>> itself, thus merging the colors you specify if it needs
>> to make room for its colors.
>
> The business about reserving 20 colors for itself is only
> true if your display resolution is set to 256 colors. It
> involves palettes which are not used when your display is
> set to either 16/24/32 bit color which is almost always
> true these days. Show your code you use to display this,
> and also tell how you are determining the real color of
> the pixel that you say is wrong.
>
> -- David
>
>

I have a 24-bit bitmap file that I carefully constructed to
have exactly 256 unique colors.
I manually convert this file to several 8-bit indexed file
formats and use BeyondCompare to show that the pixels are
identical.
I open the same 24-bit 256 color bitmap file using either
GDI+ or CImage and then save this file as GIF.
The BeyondCompare now shows that the shades of the pixels
have changed. Other people are reporting this same problem.


From: David Ching on
"Peter Olcott" <NoSpam(a)OCR4Screen.com> wrote in message
news:3JudnSIw7-GqBxPWnZ2dnUVZ_jWdnZ2d(a)giganews.com...
> I have a 24-bit bitmap file that I carefully constructed to have exactly
> 256 unique colors.
> I manually convert this file to several 8-bit indexed file formats and use
> BeyondCompare to show that the pixels are identical.
> I open the same 24-bit 256 color bitmap file using either GDI+ or CImage
> and then save this file as GIF.
> The BeyondCompare now shows that the shades of the pixels have changed.
> Other people are reporting this same problem.

I thought you had drawn it on the screen, done an Alt+Prtsc to copy to
clipboard and pasted into a graphics program in order to see what color the
pixels were! Given the screen has nothing to do with it, what I said about
the 20 color reserve doesn't hold. But what you said isn't true either.
This article says GDI+ saves the GIF image using the web safety palette:

http://msdn.microsoft.com/en-us/library/aa479306.aspx

-- David

From: Joseph M. Newcomer on
Note also my ColorPicker program lets you examine the actual pixels on the screen and see
what colors they are. Download from my MVP Tips site. I use it all the time.
joe
On Wed, 3 Mar 2010 13:49:37 -0800, "David Ching" <dc(a)remove-this.dcsoft.com> wrote:

>"Peter Olcott" <NoSpam(a)OCR4Screen.com> wrote in message
>news:3JudnSIw7-GqBxPWnZ2dnUVZ_jWdnZ2d(a)giganews.com...
>> I have a 24-bit bitmap file that I carefully constructed to have exactly
>> 256 unique colors.
>> I manually convert this file to several 8-bit indexed file formats and use
>> BeyondCompare to show that the pixels are identical.
>> I open the same 24-bit 256 color bitmap file using either GDI+ or CImage
>> and then save this file as GIF.
>> The BeyondCompare now shows that the shades of the pixels have changed.
>> Other people are reporting this same problem.
>
>I thought you had drawn it on the screen, done an Alt+Prtsc to copy to
>clipboard and pasted into a graphics program in order to see what color the
>pixels were! Given the screen has nothing to do with it, what I said about
>the 20 color reserve doesn't hold. But what you said isn't true either.
>This article says GDI+ saves the GIF image using the web safety palette:
>
>http://msdn.microsoft.com/en-us/library/aa479306.aspx
>
>-- David
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm