cannot match color with fromargb

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

When I use the following commands I do not get a solid color loks like some
dots are in it.

Dim bmp As New Bitmap(479, 30)
Dim gfx As Graphics
gfx = Graphics.FromImage(bmp)
Dim BGroundBrush As New SolidBrush(Color.FromArgb(255, 64, 64, 64))
gfx.FillRectangle(BGroundBrush, 0, 0, 479, 30)
bmp.Save(Response.OutputStream, ImageFormat.Gif)

I want the color to match the following html
<div style = " background-color:#404040" />
 
NeedToKnow said:
When I use the following commands I do not get a solid color loks like some
dots are in it.

Dim bmp As New Bitmap(479, 30)
Dim gfx As Graphics
gfx = Graphics.FromImage(bmp)
Dim BGroundBrush As New SolidBrush(Color.FromArgb(255, 64, 64, 64))
gfx.FillRectangle(BGroundBrush, 0, 0, 479, 30)
bmp.Save(Response.OutputStream, ImageFormat.Gif)

I want the color to match the following html
<div style = " background-color:#404040" />

The color is correct. The dots comes from dithering done when the image
is converted to an indexed image when saving it as gif. The color is
dithered because that color is not part of the palette.

If you don't want the color to be dithered, you have to do the
conversion to an indexed image yourself, so that you can make sure that
the color is in the palette.
 
NeedToKnow said:
Sorry about my ignorance, what is an indexed image and how do I convert to it?

An indexed image is an image that has a color palette, and each pixel is
descibed with an index value that maps to a color in the palette.

I don't know how to best do the conversion, I have never done it myself.
Here are some pages I found when googling:

http://support.microsoft.com/kb/319061
http://www.thescripts.com/forum/thread274096.html
http://www.codeproject.com/cs/media/TTF_to_bitmap_convert.asp
http://www.wischik.com/lu/programmer/1bpp.html
 
Back
Top