Not as easy as I'd hope though simply because you cant modify an image which is compressed or encoded, you have to decode it first! This is shown here:-
m_oImage is the original image loaded from file, and oNewImage is the resulting altered image
Bitmap oNewImage = new Bitmap(m_oImage.Width, m_oImage.Height, PixelFormat.Format24bppRgb);
oNewImage.SetResolution(m_oImage.HorizontalResolution, m_oImage.VerticalResolution);
Graphics oGraphics = Graphics.FromImage(oNewImage);
oGraphics.DrawImage(m_oImage, 0, 0);
//The drawing part
SolidBrush semiTransBrush = new SolidBrush(Color.FromArgb(153, oSitePoint.Colour));
Pen oPen = new Pen(oSitePoint.Colour, 2);
Font crFont = new Font("arial", 14, FontStyle.Bold);
oGraphics.DrawString("HELLO!", crFont, oPen.Brush, oSitePoint.X + 10, oSitePoint.Y - 10);
The part in blue is really important, Id left this out and got some really funny results!
Ross
No comments:
Post a Comment