473,386 Members | 1,734 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,386 software developers and data experts.

Bitmap Save method gives "Parameter is not valid"

I have an image which I'm trying to save using

my_image.Save(some_path, System.Drawing.Imaging.ImageFormat.Path);

and then I get the error "Parameter is not valid".
What could be the reason for this error? I know I can store it as a Png file.
Jul 31 '07 #1
7 21484
On 31 Jul, 10:58, Joachim <Joac...@discussions.microsoft.comwrote:
I have an image which I'm trying to save using

my_image.Save(some_path, System.Drawing.Imaging.ImageFormat.Path);

and then I get the error "Parameter is not valid".
What could be the reason for this error? I know I can store it as a Png file.
ImageFormat.Path doesn't exist as far as I can see. Try changing it to
Jpeg just to test. What format do you want to save it as?

Jul 31 '07 #2
Sorry, I wrote wrong. It should be Png

"DeveloperX" wrote:
On 31 Jul, 10:58, Joachim <Joac...@discussions.microsoft.comwrote:
I have an image which I'm trying to save using

my_image.Save(some_path, System.Drawing.Imaging.ImageFormat.Path);

and then I get the error "Parameter is not valid".
What could be the reason for this error? I know I can store it as a Png file.

ImageFormat.Path doesn't exist as far as I can see. Try changing it to
Jpeg just to test. What format do you want to save it as?

Jul 31 '07 #3
Joachim wrote:
Sorry, I wrote wrong. It should be Png

"DeveloperX" wrote:
>On 31 Jul, 10:58, Joachim <Joac...@discussions.microsoft.comwrote:
>>I have an image which I'm trying to save using

my_image.Save(some_path, System.Drawing.Imaging.ImageFormat.Path);

and then I get the error "Parameter is not valid".
What could be the reason for this error? I know I can store it as a Png file.
ImageFormat.Path doesn't exist as far as I can see. Try changing it to
Jpeg just to test. What format do you want to save it as?

Then there's only one parameter left that can be invalid.

What does some_path contain?

--
Göran Andersson
_____
http://www.guffa.com
Jul 31 '07 #4
An existing path, including file name (which does not exist).

"Göran Andersson" wrote:
Joachim wrote:
Sorry, I wrote wrong. It should be Png

"DeveloperX" wrote:
On 31 Jul, 10:58, Joachim <Joac...@discussions.microsoft.comwrote:
I have an image which I'm trying to save using

my_image.Save(some_path, System.Drawing.Imaging.ImageFormat.Path);

and then I get the error "Parameter is not valid".
What could be the reason for this error? I know I can store it as a Png file.
ImageFormat.Path doesn't exist as far as I can see. Try changing it to
Jpeg just to test. What format do you want to save it as?


Then there's only one parameter left that can be invalid.

What does some_path contain?

--
Göran Andersson
_____
http://www.guffa.com
Jul 31 '07 #5
On 31 Jul, 12:04, Joachim <Joac...@discussions.microsoft.comwrote:
An existing path, including file name (which does not exist).

"Göran Andersson" wrote:
Joachim wrote:
Sorry, I wrote wrong. It should be Png
"DeveloperX" wrote:
>On 31 Jul, 10:58, Joachim <Joac...@discussions.microsoft.comwrote:
>>I have an image which I'm trying to save using
>>my_image.Save(some_path, System.Drawing.Imaging.ImageFormat.Path);
>>and then I get the error "Parameter is not valid".
>>What could be the reason for this error? I know I can store it as aPng file.
>ImageFormat.Path doesn't exist as far as I can see. Try changing it to
>Jpeg just to test. What format do you want to save it as?
Then there's only one parameter left that can be invalid.
What does some_path contain?
--
Göran Andersson
_____
http://www.guffa.com- Hide quoted text -

- Show quoted text -
Check what the string holds. If you've got something like

string some_path = "C:\pics\whatever";
that will actually turn the \p and \w into escape codes (if they're
valid ones)

so use the @ like so:
string some_path = @"C:\pics\whatever";

if you've got my_image.Save("C:\mypath",
System.Drawing.Imaging.ImageFormat.Png);
again just put an @ at the start.
my_image.Save(@"C:\mypath", System.Drawing.Imaging.ImageFormat.Png);
Jul 31 '07 #6
I've got double backslash (\\).

"DeveloperX" wrote:
On 31 Jul, 12:04, Joachim <Joac...@discussions.microsoft.comwrote:
An existing path, including file name (which does not exist).

"Gvran Andersson" wrote:
Joachim wrote:
Sorry, I wrote wrong. It should be Png
"DeveloperX" wrote:
On 31 Jul, 10:58, Joachim <Joac...@discussions.microsoft.comwrote:
>I have an image which I'm trying to save using
>my_image.Save(some_path, System.Drawing.Imaging.ImageFormat.Path);
>and then I get the error "Parameter is not valid".
>What could be the reason for this error? I know I can store it as a Png file.
ImageFormat.Path doesn't exist as far as I can see. Try changing it to
Jpeg just to test. What format do you want to save it as?
Then there's only one parameter left that can be invalid.
What does some_path contain?
--
Gvran Andersson
_____
>http://www.guffa.com- Hide quoted text -
- Show quoted text -

Check what the string holds. If you've got something like

string some_path = "C:\pics\whatever";
that will actually turn the \p and \w into escape codes (if they're
valid ones)

so use the @ like so:
string some_path = @"C:\pics\whatever";

if you've got my_image.Save("C:\mypath",
System.Drawing.Imaging.ImageFormat.Png);
again just put an @ at the start.
my_image.Save(@"C:\mypath", System.Drawing.Imaging.ImageFormat.Png);
Aug 1 '07 #7
I'm having the same problem...my path is correct, and the ImageFormat is correct. But it continues to give me the same error "Parameter is not valid"

If you figured the solution out, please post, I'll continue to look around.
Aug 8 '07 #8

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

Similar topics

22
by: Dr Duck | last post by:
GDay all, Something seems odd to me.... I wrote a simple C# function public void bind(ref object a, ref object b, bool atob) { if(atob) b = a; else
3
by: kj | last post by:
This problem is driving me nuts. The code at the end of this post below works fine with IE, but fails with Mozilla. You can see it in action at http://tinyurl.com/2jvo3 With Mozilla 1.4 and...
13
by: baumann.Pan | last post by:
when define char *p = " can not modify"; p ='b' ;is not allowed, but if you declare p as char p = "can modify"; p = 'b'; is ok? why?
0
by: ligyfrancis | last post by:
Hi, When I try to save a stored procedure in MS Access, I get the message "Parameter Incorrect." I have database owner's priveleges. Could you pls help me out regarding this? Thanks, Ligy
2
by: Mr Flibble | last post by:
Hi All I've decided to put my stylesheets in a base64 .resource file for deployment and versioning reasons. I dont know if it's a great idea to do this but I couldn't think of another way of...
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...
5
by: amatuer | last post by:
hi i have a link from page1 to page2. this link uses a querystring to transfer data. usually i have no problems using querystring t transfer data. bt for the first time page2 does not display.an...
1
by: illegal.prime | last post by:
Hey all, I have an app, that could take two numbers of any type of numerical type int, long, double, float, uint, ulong, etc. I want to check that the numbers are part of a range that I consider...
11
by: John Nagle | last post by:
I passed a dict for the "env" variable to Popen with Unicode strings for the dictionary values. Got: File "D:\Python24\lib\subprocess.py", line 706, in _execute_child TypeError: environment...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.