Click here to Skip to main content
15,946,012 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I want to set the height and width while saving the bitmap. Height = 592 and Width = 699 to be set

This error occurs: No overload for method 'Save' tasks 4 arguments.


What I have tried:

varas.zoom = croped;
croped.Save(paths + "\\" + "SPR_" + i + ".jpeg", ImageFormat.Jpeg, Height = 592, Width = 699);
Posted
Updated 18-Dec-22 19:28pm

1 solution

The message is explicit: Save does not have a version which allows you to modify the image when you save it in any practical way.

If you want to save an image at a specific size, then you write code to generate a new image at that size (cropping / shrinking / padding / stretching as appropriate) and save the new image. There is no standard method to do that because the system has no idea what kind of resizing would be appropriate for your application!
 
Share this answer
 
Comments
Dave Kreskowiak 19-Dec-22 9:05am    
I love how they don't bother to read the documentation on the Save method and just start throwing random parameters at it expecting that to work.
OriginalGriff 19-Dec-22 10:21am    
You can probably stop after "documentation". :sigh:
Dave Kreskowiak 19-Dec-22 11:02am    
:sigh: You are correct, of course.
OriginalGriff 19-Dec-22 11:05am    
I was feeling generous when I stops at "documentation" - it was soooo tempted to stop at "the" :D
Dave Kreskowiak 19-Dec-22 11:08am    
:laugh:

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900