473,473 Members | 2,286 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

cannot match color with fromargb

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" />

Aug 7 '07 #1
3 1614
NeedToKnow wrote:
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.

--
Göran Andersson
_____
http://www.guffa.com
Aug 7 '07 #2
Sorry about my ignorance, what is an indexed image and how do I convert to it?

"Göran Andersson" wrote:
NeedToKnow wrote:
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.

--
Göran Andersson
_____
http://www.guffa.com
Aug 7 '07 #3
NeedToKnow wrote:
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/...ap_convert.asp
http://www.wischik.com/lu/programmer/1bpp.html

--
Göran Andersson
_____
http://www.guffa.com
Aug 7 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Steve Randall | last post by:
I use a ColorDialog control to select a number of custom colours using the code segment below, I've fixed the index to 0 for the purpose of highlighting the problem. Dim intRed As Integer Dim...
19
by: jcrouse | last post by:
I decided to start a new thread. I have output in xml file format. It looks like this: <P1JoyUp> <Top>326</Top> <Left>54</Left> <Height>23</Height> <Width>100</Width> <Visible>True</Visible>...
2
by: Sam | last post by:
Hi All I'm having problem (which seems to be simple) to convert my color settings using FromArgb method. The colors are saved to a text file as string, using ToArgb.ToString method. For example...
4
by: Teemu | last post by:
I'm wondering if there is a easy way to change for example toolstrips appearance. I'd like to have the same theme as in VB2005. Brown backgroung instead of the light blue. Can this be done without...
5
by: Bob Homes | last post by:
In VB6, foreground and background colors of controls had to be assigned a single number. If you knew the RGB values for the color, you still had to convert them into the single number accepatable...
1
by: sp | last post by:
I have this strange problem. The application I am working on imports color values from Flash that look like this: 0x-f9fff6 And, on the script side, it uses a conversion algorithm to convert...
11
by: Yaniv | last post by:
Hi How can I convert Uint32 variable to System.drawing.color ?? Thanks in advanced Yaniv
4
by: Harvey Triana | last post by:
Hi. Say, in VB6: Const CLR2 As Long = &HFFF0DC ' light blue AnyObj.BackColor = CLR2 - How is the equivalent one in C#? Thanks, <Harvey Triana />
3
by: Larry | last post by:
I'm sure I've missed the obvious, but when I define a custom color, my DrawString call from my Paint event doesn't seem to draw anything at all. void btnNav_Paint(object sender, PaintEventArgs...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.