After create newBitmap i m getting exception - Parameter is not valid , When i want to create 9000*9000 pixel image. I need to create big resolution image. I cant able to create big Image because of this error.
My RAM is 16 GB .My system is 64 bit. Sometime it occurs Out of memory also. How to solve this issue ?
Here is my code
private Bitmap createBigImage(Bitmap layerBitmap, int newWidth, int newHeight)
{
Bitmap newBitmap = new Bitmap(newWidth, newHeight, PixelFormat.Format32bppArgb);
using (Graphics gr = Graphics.FromImage(newBitmap))
{
gr.SmoothingMode = SmoothingMode.HighQuality;
gr.InterpolationMode = InterpolationMode.HighQualityBicubic;
gr.PixelOffsetMode = PixelOffsetMode.HighQuality;
gr.DrawImage(layerBitmap, new Rectangle(0, 0, newWidth, newHeight));
gr.Dispose();
}
return newBitmap;
}
Bitmap newbitmap = createBigImage(bitmap, 9000, 9000);