General discussion

  • Creator
    Topic
  • #2210775

    Parameter is not valid [stream to bitmap ]

    Locked

    by sumesh.nambron ·

    Hi,
    I use to store images in a single file using, by adding each files stream into it and index of each file will be maintained in database. Now some of the images i could not save back to bitmap format i am getting an error like “Parameter invalid”

All Comments

  • Author
    Replies
    • #2901105

      Could be anything that

      by tony hopkinson ·

      In reply to Parameter is not valid [stream to bitmap ]

      Need some code, or at least a vague clue as to what language etc your are working with ….

      • #2440511

        Parameter is not valid [stream to bitmap ]

        by sumesh.nambron ·

        In reply to Could be anything that

        Updation

        System.IO.FileStream fs2_EN;
        System.IO.FileStream fs1_EN;
        MemoryStream mStr_EN;
        dir_EN = “C:\image1.jpg “;
        fs1_EN = new System.IO.FileStream(dir_EN, FileMode.Open);
        data1_EN = new byte[fs1_EN.Length];
        fs1_EN.Read(data1_EN, 0, data1_EN.Length);
        fs1_EN.Seek(0, SeekOrigin.Begin);
        fs2_EN = new System.IO.FileStream(???File.data???, FileMode.Append);
        fs2_EN.Seek(0, SeekOrigin.End);
        fs2_EN.Write(data1_EN, 0, data1_EN.Length);

        retrival

        imgVal = ???72964#105860#75588#113802#81206???

        byte[] data1
        System.IO.FileStream outFileStream;
        string[] imgPos;

        outFileStream = new System.IO.FileStream(Path, System.IO.FileMode.Open);
        data1 = new byte[outFileStream.Length];
        imgPos = imgVal.Split(‘#’);
        for (int i = 0; i <= imgPos.GetUpperBound(0); i++) { fName =???C:\Image1.tif???; imgByte = int.Parse(imgPos[i].ToString()); outFileStream.Seek(0, SeekOrigin.Current); outFileStream.Read(data1, 0, imgByte); mStr = new MemoryStream(data1, 0, imgByte); bMap = new Bitmap(mStr); bMap.Save(fName,System.Drawing.Imaging.ImageFormat.Jpeg); mStr.Close(); }

Viewing 0 reply threads