Last post Jul 28, 2008 05:10 PM by exrescueswimmer
May 21, 2005 07:29 PM|geoffHome|LINK
I'm out of my depth but I know this routine works but when I apply it to my own ends I get this error. Can someone please shed some light as to the likely cause. The imageFile object exists and is a byte array.
Exception Details: System.ArgumentException: Parameter is not valid.
Line 46: Private Function ResizeImageFile(ByVal imageFile() As Byte, ByVal targetSize As Integer) As Byte()
Line 47: Dim original As System.Drawing.Image
Line 48: original = System.Drawing.Image.FromStream(New MemoryStream(imageFile))
Line 49: Dim targetH As Integer
Line 50: Dim targetW As Integer
[ArgumentException: Parameter is not valid.]
System.Drawing.Image.FromStream(Stream stream, Boolean useEmbeddedColorManagement, Boolean validateImageData) +339
System.Drawing.Image.FromStream(Stream stream, Boolean useEmbeddedColorManagement) +33
System.Drawing.Image.FromStream(Stream stream) +27
Feb 14, 2006 12:24 PM|VBAHole22|LINK
Feb 15, 2006 07:31 AM|Jigar|LINK
if imageFile is your byte array then following will work.
Dim ms As New MemoryStream()
ms.Write(imageFile, 0, imageFile.Length)
Dim original As New System.Drawing.Bitmap(ms)
May 15, 2008 12:17 PM|needo001|LINK
its not working, i am tires and still have error.
insert code is:
insert code is working. but retrieve code not working:
ms.Write(imageData, 0, imageData.Length);
at last line i get exception "Parameter is not valid". i tried
newImage = System.Drawing.Image.FromStream(ms,true);
as well but same problem.
Please please help. i am stuck
May 22, 2008 06:03 AM|mohanish|LINK
jst check it out with the following solution
it works for me
Bitmap btm = new Bitmap(rr.ToString());//give the path from where u want the exact image
Bitmap btm_new = new Bitmap(btm, btm.Width, btm.Height);
Graphics g = Graphics.FromImage(btm_new);
btm = btm_new;
btm.Save("");//jst give the path where u want to save that image
Jul 28, 2008 05:10 PM|exrescueswimmer|LINK
getting nearly the exact same thing - did you ever find a solution?