Is it possible to open an image and edit that image by drawing on the image, means loading an image and just making some scratches on it like we can do that in Windows Paint.
How can I do that in .Net Compact Framework using C# ?
Of course you can. Simply open the image using Image.FromFile()
, then create a Graphics
object against this image by using Graphics.FromImage()
and then use GDI+ methods like DrawLine()
, DrawRectangle()
, DrawString()
etc. to make changes to it. At the end, use Image.Save()
function to save your changes back to the file.
Something on the following lines:
Image img = Image.FromFile("<FILE_PATH>");
using (Graphics g = Graphics.FromImage(img))
g.DrawLine(Pens.Black, 10,10, 20,20);
img.Save("<FILE_PATH>");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With