GDI color depth?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • RobT

    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.FromIm age(bmp)
    g.Clear(Color.W hite)
    g.SmoothingMode = SmoothingMode.A ntiAlias
    Dim brsh As SolidBrush
    brsh = New SolidBrush(Colo r.DarkGoldenrod )
    g.FillPie(brsh, 10, 10, 50, 50, 0, 360)

    Thanks

  • Herfried K. Wagner [MVP]

    #2
    Re: GDI color depth?

    "RobT" <rtorcellini@NO walchemSPAM.com schrieb:
    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.FromIm age(bmp)
    g.Clear(Color.W hite)
    g.SmoothingMode = SmoothingMode.A ntiAlias
    Dim brsh As SolidBrush
    brsh = New SolidBrush(Colo r.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/>

    Comment

    • RobT

      #3
      Re: GDI color depth?

      Thanks for the pointers. I did modify the Save method to be jpeg instead
      and that helps.

      bmp.Save(Respon se.OutputStream , ImageFormat.Jpe g)

      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]" <hirf-spam-me-here@gmx.atwrot e in message
      news:eIK7Ng6PJH A.3936@TK2MSFTN GP06.phx.gbl...
      "RobT" <rtorcellini@NO walchemSPAM.com schrieb:
      >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.FromIm age(bmp)
      > g.Clear(Color.W hite)
      > g.SmoothingMode = SmoothingMode.A ntiAlias
      > Dim brsh As SolidBrush
      > brsh = New SolidBrush(Colo r.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/>

      Comment

      • Armin Zingler

        #4
        Re: GDI color depth?

        "RobT" <rtorcellini@NO walchemSPAM.com schrieb
        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.
        Learn how to adjust the quality of a JPEG image by modifying its compression level on Windows Forms.



        Armin

        Comment

        • RobT

          #5
          Re: GDI color depth?

          Thanks....I just discovered that myself! Works great.

          "Armin Zingler" <az.nospam@free net.dewrote in message
          news:u8sDt$6PJH A.1148@TK2MSFTN GP05.phx.gbl...
          "RobT" <rtorcellini@NO walchemSPAM.com schrieb
          >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.
          >
          Learn how to adjust the quality of a JPEG image by modifying its compression level on Windows Forms.

          >
          >
          Armin
          >

          Comment

          • Andrew Morton

            #6
            Re: GDI color depth?

            RobT wrote:
            Thanks for the pointers. I did modify the Save method to be jpeg
            instead and that helps.
            >
            bmp.Save(Respon se.OutputStream , ImageFormat.Jpe g)
            >
            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


            Comment

            Working...