i want to write 3 text on the specific image. There isn't any problem on localhost. But on the server,i try everything but nothing has changed. always say: A generic error occurred in GDI+.
if i write text on the image step by step,i got same error. After i add first text, second and third text can not be added on the image because of proccessing on the image with first text.
Summary:
First i want to add text1 on img1 and Dispose. Second i want to add text2 on img1 and Dispose. Third i want to add text3 on img1 and Dispose.
using (Bitmap bitmapMasterImage = new Bitmap(stringMasterImageName))
{
using (Graphics graphicsMasterImage = Graphics.FromImage(bitmapMasterImage))
{
graphicsMasterImage.DrawString(stringText1, new Font("Arial", 20, FontStyle.Bold), new SolidBrush(colorStringColor), new Point(233, 134), stringformatWriteTextFormat);
graphicsMasterImage.DrawString(stringText2, new Font("Arial", 20, FontStyle.Bold), new SolidBrush(colorStringColor), new Point(233, 210), stringformatWriteTextFormat);
graphicsMasterImage.DrawString(stringText3, new Font("Arial", 20, FontStyle.Bold), new SolidBrush(colorStringColor), new Point(233, 300), stringformatWriteTextFormat);
}
Response.Clear();
Response.ContentType = "image/jpeg";
using (MemoryStream stream = new MemoryStream())
{
bitmapMasterImage.Save(stream, ImageFormat.Jpeg);
bitmapMasterImage.Save(stringOutPutFileName);
stream.WriteTo(Response.OutputStream);
}
}
Thank You