Reputation: 2055
I would like to add to picture black box. How to do it?
using (var image = Image.FromFile(imagePath))
{
using (var newImage = ScaleImage(image, 300, 400))
{
int width = newImage.Size.Width;
int height = newImage.Size.Height;
Graphics DrawingSurface = Graphics.FromImage(newImage);
//graphics.DrawRectangle(); ????
newImage.Save(imagePathDuzy);
}
}
Upvotes: 1
Views: 133
Reputation: 36320
Use one of the FillRectangle methods on the Graphics type: http://msdn.microsoft.com/en-us/library/yysstebh.aspx
Probably something like this:
DrawingSurface.FillRectangle(new SolidBrush(Colors.Black), new Rectangle(0, height - 100, width, height));
This shold draw a black rectangle with 100px height at the bottom of the image.
Upvotes: 5