locked
cannot convert from 'byte[]' to 'System.IO.Stream' RRS feed

  • Question

  • User135331403 posted

    Is there a way to convert it?

    byte[] imageBytes;
    imageBytes = (
    byte[])dsPhotosFiles.Tables[0].Rows[i]["fileBytes"];
    saveImage(imageBytes, 400, Server.MapPath(
    @"\images\houses\" + fileName));

    private void saveImage(byte[] imageBytes, int thumbWidth, string imagePath)
    {
    System.Drawing.
    Image image = System.Drawing.Image.FromStream(imageBytes);

    ...........

    Sunday, December 7, 2008 7:11 AM

Answers

  • User-595745061 posted

     I have tried this on my system and working perfect -

              object objByte = sigObj.GetBitmapBufferBytes(); 
              byte[] bytData = (byte[])objByte;
              sigObj.BitMapBufferClose();
              System.IO.MemoryStream ms = new System.IO.MemoryStream(bytData);
              System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(ms);

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, December 7, 2008 9:56 AM

All replies

  • User-595745061 posted

     First convert bute[] to Object and then Convert Object to System.IO.Stream

    Sunday, December 7, 2008 8:23 AM
  • User135331403 posted

    How?

    Sunday, December 7, 2008 8:36 AM
  • User-595745061 posted

     I have tried this on my system and working perfect -

              object objByte = sigObj.GetBitmapBufferBytes(); 
              byte[] bytData = (byte[])objByte;
              sigObj.BitMapBufferClose();
              System.IO.MemoryStream ms = new System.IO.MemoryStream(bytData);
              System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(ms);

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, December 7, 2008 9:56 AM