General discussion

Locked

Parameter is not valid [stream to bitmap ]

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"

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Could be anything that

by Tony Hopkinson In reply to Parameter is not valid [s ...

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

Collapse -

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.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();
}

Back to Software Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums