I want to write text on an image then save it, but my code has runtime error.
error : System.PlatformNotSupportedException: 'Operation is not supported on this platform.'
using System.Drawing;
public void Watermark(string picturePath, string text)
{
PointF firstLocation = new PointF(10f, 10f);
PointF secondLocation = new PointF(10f, 50f);
Bitmap bitmap = (Bitmap)Image.FromFile(picturePath);//load the image file
using (Graphics graphics = Graphics.FromImage(bitmap))
{
using (Font arialFont = new Font("Arial", 10))
{
graphics.DrawString(text, arialFont, Brushes.Blue, firstLocation);
}
}
bitmap.Save(picturePath);
}