Click here to Skip to main content
15,886,664 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
How to crop an image using C#?
Posted
Updated 2-Oct-22 8:01am

Google is your best friend. you can make use of it...

still these links can help you ...

image resize and cropping[^]

Cropping Particular Region In Image Using C# [^]

Cropping Images[^]


simple way is

C#
Image img = Image.FromFile("d:\\yourimage.jpg");
           Bitmap bmp= new Bitmap(img);
           Bitmap crop= bmp.Clone(new Rectangle(100, 100, 300, 300), bmpImage.
           PixelFormat);

             crop.Save("d:\\yourimage1.jpg");
 
Share this answer
 
I just made a custom class to simply crop any control that has an image or background image. i have uploaded it to github.com: https://github.com/DwainSnickles/ControlCrop/blob/master/README.md
 
Share this answer
 
Comments
Richard Deeming 3-Oct-22 4:58am    
Resurrecting ancient questions to promote your project is considered spam, and will get you kicked off the site.

If you want to promote your project, then import it as an article[^]. Do not spam links to your project to random old threads.
charles henington 3-Oct-22 14:46pm    
This question comes up halfway down the first page of C# questions. When reading through questions would it be presumable that this should be a new question not years old? Why would an old question be close to top of current questions?
Richard Deeming 4-Oct-22 3:31am    
Questions sometimes appear further up the list when a spammer has resurrected them to post a spam solution, and that solution has since been deleted. However, given the unbroken solution numbering here, that is not what happened.

There is no moratorium on answering old questions. But when that answer is simply "Hey, look at my shiny new project!", then your answer is spam.

I suggest you delete this solution, and import your project as an article instead.

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