How to create 1024x1024 RGB bitmap image of white?

You are assigning a new image to resultImage, thereby overwriting your previous attempt at creating a white image (which should succeed, by the way).

So just remove the line

resultImage = new Bitmap(image1.Width, image1.Height, grp);

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;
}

Tags:

C#