Re: Background of text is mottled
From: Rutger Smit (DoDotNet_at_gmail.com)
Date: 09/02/04
- Next message: Rich Denis: "Re: Adding httpModules problems"
- Previous message: Ken Cox [Microsoft MVP]: "Not a Stupid question about ASP.NET..."
- In reply to: MarkMurphy: "Background of text is mottled"
- Next in thread: Steven Cheng[MSFT]: "Re: Background of text is mottled"
- Reply: Steven Cheng[MSFT]: "Re: Background of text is mottled"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 03 Sep 2004 01:41:00 +0200
MarkMurphy wrote:
> Hi,
>
> I'm using the code below to create a background and then write some
> text on it. The area behind the text appears pixelated in the output
> image. I've tried output to jpeg and gif but result is the same.
>
> private void DrawImage()
> {
> string s = "A TEST CAPTION";
> Rectangle frame;
> Font f = new Font("Arial", 10);
> SolidBrush sb;
> Response.ContentType = "image/jpeg";
>
> Bitmap bmp = new Bitmap(200, 24);
> Graphics g = Graphics.FromImage(bmp);
>
> //Draw caption area
> sb = new SolidBrush(Color.Gray);
> frame = new Rectangle(0, 0, 200, 24);
> g.FillRectangle(sb, frame);
>
> f = new Font("Arial", 10);
> sb = new SolidBrush(Color.Black);
> g.DrawString(s, f, sb, 8, 4);
>
> // Send image
> bmp.Save(Response.OutputStream, ImageFormat.Jpeg);
>
> bmp.Dispose();
> g.Dispose();
> sb.Dispose();
> }
Two questions:
1: don't you have to call g.Save(); ?
2: does it get better if you add this line: g.SmoothingMode =
SmoothingMode.HighQuality; ?
Regards,
//Rutger
- Next message: Rich Denis: "Re: Adding httpModules problems"
- Previous message: Ken Cox [Microsoft MVP]: "Not a Stupid question about ASP.NET..."
- In reply to: MarkMurphy: "Background of text is mottled"
- Next in thread: Steven Cheng[MSFT]: "Re: Background of text is mottled"
- Reply: Steven Cheng[MSFT]: "Re: Background of text is mottled"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|