I want to convert a string of data that is passed into my controller to an image file like .jpeg or png. I know, in the past, ASP.NET use to support Bitmap, but now in .NET Core, Bitmap doesn't seem to be supported.
When I wrote the code below
Bitmap bmp = new(100, 100);
using (Graphics graphics = Graphics.FromImage(bmp))
{
Font font = new Font("Journal", 20.0f);
graphics.FillRectangle(new SolidBrush(Color.Blue), 0, 0, bmp.Width, bmp.Height);
graphics.DrawString(text, font, new SolidBrush(Color.Blue), 0, 0);
}
return bmp;
Here, I am getting an error saying that graphics. Drawstring is only supported on Windows.
How can I convert a text to an image in .NET Core with Razor front end?