469,599 Members | 2,897 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,599 developers. It's quick & easy.

GDI color depth?

I'll admit, that I don't do a lot of GDI+ programming and I'm sure this is
an easy answer. I'm trying to draw a couple of shapes in a web site. I can
display them just fine, but on some of the fill colors are pixelated. Is
there a way to render these colors at a better color depth?

Dim bmp As Bitmap
bmp = New Bitmap(200, 200)
Dim g As Graphics
g = Graphics.FromImage(bmp)
g.Clear(Color.White)
g.SmoothingMode = SmoothingMode.AntiAlias
Dim brsh As SolidBrush
brsh = New SolidBrush(Color.DarkGoldenrod)
g.FillPie(brsh, 10, 10, 50, 50, 0, 360)

Thanks

Nov 6 '08 #1
5 3240
"RobT" <rt*********@NOwalchemSPAM.comschrieb:
I'll admit, that I don't do a lot of GDI+ programming and I'm sure this is
an easy answer. I'm trying to draw a couple of shapes in a web site. I
can display them just fine, but on some of the fill colors are pixelated.
Is there a way to render these colors at a better color depth?

Dim bmp As Bitmap
bmp = New Bitmap(200, 200)
Dim g As Graphics
g = Graphics.FromImage(bmp)
g.Clear(Color.White)
g.SmoothingMode = SmoothingMode.AntiAlias
Dim brsh As SolidBrush
brsh = New SolidBrush(Color.DarkGoldenrod)
g.FillPie(brsh, 10, 10, 50, 50, 0, 360)
Take a look at the different constructors of the 'Bitmap' class. In
addition, take a look at the different overloads of the 'Save' method. Note
that some image formats, such as GIF, only support a certain number of
colors in the image making dithering necessary.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 6 '08 #2
Thanks for the pointers. I did modify the Save method to be jpeg instead
and that helps.

bmp.Save(Response.OutputStream, ImageFormat.Jpeg)

Now, is there a way to reduce the amount of compression of the jpeg so the
image is sharper? I(I have some other lines, text etc in my output). The
antialias looks fine...I'm pretty sure the compression is too high.

Thanks!

"Herfried K. Wagner [MVP]" <hi***************@gmx.atwrote in message
news:eI**************@TK2MSFTNGP06.phx.gbl...
"RobT" <rt*********@NOwalchemSPAM.comschrieb:
>I'll admit, that I don't do a lot of GDI+ programming and I'm sure this
is an easy answer. I'm trying to draw a couple of shapes in a web site.
I can display them just fine, but on some of the fill colors are
pixelated. Is there a way to render these colors at a better color depth?

Dim bmp As Bitmap
bmp = New Bitmap(200, 200)
Dim g As Graphics
g = Graphics.FromImage(bmp)
g.Clear(Color.White)
g.SmoothingMode = SmoothingMode.AntiAlias
Dim brsh As SolidBrush
brsh = New SolidBrush(Color.DarkGoldenrod)
g.FillPie(brsh, 10, 10, 50, 50, 0, 360)

Take a look at the different constructors of the 'Bitmap' class. In
addition, take a look at the different overloads of the 'Save' method.
Note that some image formats, such as GIF, only support a certain number
of colors in the image making dithering necessary.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 6 '08 #3
"RobT" <rt*********@NOwalchemSPAM.comschrieb
Now, is there a way to reduce the amount of compression of the jpeg so the
image is sharper? I(I have some other lines, text etc in my output).
The antialias looks fine...I'm pretty sure the compression is too high.
http://msdn.microsoft.com/en-us/library/bb882583.aspx
Armin

Nov 6 '08 #4
Thanks....I just discovered that myself! Works great.

"Armin Zingler" <az*******@freenet.dewrote in message
news:u8**************@TK2MSFTNGP05.phx.gbl...
"RobT" <rt*********@NOwalchemSPAM.comschrieb
>Now, is there a way to reduce the amount of compression of the jpeg so
the
image is sharper? I(I have some other lines, text etc in my output).
The antialias looks fine...I'm pretty sure the compression is too high.

http://msdn.microsoft.com/en-us/library/bb882583.aspx
Armin
Nov 6 '08 #5
RobT wrote:
Thanks for the pointers. I did modify the Save method to be jpeg
instead and that helps.

bmp.Save(Response.OutputStream, ImageFormat.Jpeg)

Now, is there a way to reduce the amount of compression of the jpeg
so the image is sharper? I(I have some other lines, text etc in my
output). The antialias looks fine...I'm pretty sure the compression
is too high.
Depending on your target audience, png could be a suitable file format.

Andrew
Nov 6 '08 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Hoagie | last post: by
3 posts views Thread by scoobydoo | last post: by
reply views Thread by Jim H | last post: by
2 posts views Thread by Onwuka Emeka | last post: by
13 posts views Thread by softwaredoug | last post: by
1 post views Thread by RobT | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.