I need a control that allows loading a picture, performing some basic drawing tasks with it (including adding text, pencil, oval, horizontal and diagonal lines), and exporting it as bitmap. Anything like that available?
Thanks
I need a control that allows loading a picture, performing some basic drawing tasks with it (including adding text, pencil, oval, horizontal and diagonal lines), and exporting it as bitmap. Anything like that available?
Thanks
Image is a good container for this task:
// Load the image from an existing file
using (var img = Image.FromFile("test.png"))
using (var g = Graphics.FromImage(img))
{
// Scratch on it
g.DrawLine(new Pen(Color.Red, 10), new Point(0, 0), new Point(100, 100));
g.DrawEllipse(new Pen(Brushes.Black), 10, 10, 100, 100);
g.DrawRectangle(new Pen(Brushes.Red), 30, 30, 40, 40);
// Save to a new file
img.Save("test2.png");
}
Check this nice article about image processing: http://www.codeproject.com/KB/GDI-plus/Image_Processing_Lab.aspx
And this: http://www.codeproject.com/KB/graphics/Painter.aspx
I've made my own control based on Mouse_Down, Mouse_Up, and Mouse_Move events of PictureBox.