It\'s embarrassing to ask this question but can\'t find an answer.
I tried this in vain.
Image resultImage = new Bitmap(image1.Width, image1.Height,
You almost had it:
private Bitmap DrawFilledRectangle(int x, int y) { Bitmap bmp = new Bitmap(x, y); using (Graphics graph = Graphics.FromImage(bmp)) { Rectangle ImageSize = new Rectangle(0,0,x,y); graph.FillRectangle(Brushes.White, ImageSize); } return bmp; }