M
MarkMurphy
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();
}
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();
}