473,395 Members | 2,713 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Invalid Parameter Used

Dear All, I have created a function to resize an image and save it to the
server. This is the code:-

try
{
System.Drawing.Image NewImg;

System.Drawing.Image.GetThumbnailImageAbort dummyCallBack =
new System.Drawing.Image.GetThumbnailImageAbort(Thumbn ailCallback);

NewImg = fullSizeImg.GetThumbnailImage(image_width, image_height,
dummyCallBack, IntPtr.Zero);
NewImg.Save(path + image_name);

int x = image_width;
int y = image_height;
string image_path = path + "\\" + image_name;
Image oImg = Image.FromFile(image_path);
Bitmap bmp = new Bitmap(x,y);

System.Drawing.Imaging.Encoder Enc = System.Drawing.Imaging.Encoder.
Transformation;
EncoderParameters EncParms = new EncoderParameters(1);
EncoderParameter EncParm;

Graphics gr = Graphics.FromImage(bmp);
gr.CompositingQuality = CompositingQuality.HighQuality;
gr.SmoothingMode = SmoothingMode.HighQuality;
gr.InterpolationMode = InterpolationMode.HighQualityBicubic;

gr.DrawImage(oImg, 0, 0, x, y);
gr.Save();

EncParms.Param = new EncoderParameter[]
{
new EncoderParameter(Enc,(long)EncoderValue.Compressio nLZW),
new EncoderParameter(System.Drawing.Imaging.Encoder.Qu ality, 100L)
};
ImageCodecInfo ici ;

ici = GetProperEncoder(image_name);

bmp.Save(image_path, ici, EncParms);
oImg.Dispose();
bmp.Dispose();

}
catch (Exception e)
{
Console.WriteLine("Caught: {0}",e.Message);
}

However I am getting an exception on this line :-

bmp.Save(image_path, ici, EncParms);

The exception is

System.Object {System.ArgumentException} "Invalid Parameter Used"

Can anybody help me please? Thanks for your help and time
Nov 17 '05 #1
0 1219

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Wally | last post by:
I am trying to display images from an Access 2000 database and I get an error "Invalid Parameter Used" when I execute the code line "picBLOB.Image = Image.FromStream(stmBLOBData)" in my Visual...
8
by: Owen Jenkins | last post by:
Hello. For years I've been using the DBEngine.CompactDatabase code to make backups of backend databases. But now I've struck a baffling problem where I get an Invalid Argument error. This...
0
by: CroDude | last post by:
Hi all! I have problems when writting bitmap to a byte array and after reading it back form byte to Bitmap object. What I do is this: First I throw Bitmap to a memory-stream and then I write it...
3
by: halise | last post by:
Hi, i am in trouble with an exception in .net platform with c#. The exception thrown is exactly as follows: System.ArgumentException: Invalid parameter used. at...
0
by: David Veeneman | last post by:
This post is for the Google archive and does not require a reply. I received an 'Invalid parameter used' error when trying to do double-buffering with the .Net SetStyles method. I used this code...
1
by: Hifni Shahzard | last post by:
Hi, I got a stored procedure, where it returns a value. But if I execute it. It gives an error as "Invalid cast from System.Int32 to System.Byte.". To make clear how do I execute this, below I'm...
3
by: Arnold | last post by:
I am having problem loading the image from the database. It gives this error: "Invalid parameter used." This is my source code: Private abyt() As Byte Private fo As New OpenFileDialog Private sf...
9
by: Tom John | last post by:
Hi I am storing images in an access database, based on an MSDN article. The code i use to store is as follows: <code> 'Create the command object Dim command As New...
4
by: escristian | last post by:
Hello. I'm trying to create an Image so I use something like this: Image newImage = Image.FromFile(filename); Now when it's a bmp file and certain .gif files it gives me an exception that...
0
by: jaffar | last post by:
Hi I am storing images in an access database, based on an MSDN article. The code i use to store is as follows: <code> 'Create the command object Dim command As New...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.