Getting an execption while converting byte array to Image and saving the image
===

    protected void Page_Load(object sender, EventArgs e)
    {
        Image obj = Image.FromFile(@"C:\Users\Public\Pictures\Sample Pictures\Desert.jpg");
        byte[] arr = imageToByteArray(obj);
        Image img2 = byteArrayToImage(arr);
        Bitmap bm = new Bitmap(img2);
        bm.Save(@"G:\test\", ImageFormat.Bmp);**----Here am getting an exception "A generic error occurred in GDI"** 

    }
    public byte[] imageToByteArray(Image imageIn)
    {
        MemoryStream ms = new MemoryStream();
        imageIn.Save(ms, System.Drawing.Imaging.ImageFormat.Gif);
        return ms.ToArray();
    }

    public Image byteArrayToImage(byte[] byteArrayIn)
    {
        MemoryStream ms = new MemoryStream(byteArrayIn);
        Image returnImage = Image.FromStream(ms);
        return returnImage;
    }


am using above functions to Convert Image to ByteArray and Vice-Versa.But after converting the bytearray to image am trying to save the image then it's throwing an exception "**A generic error occurred in GDI** "

Thanks in advance.