Guide for C#
Core Document Formats
Additional Features
Image Cropping

C# Imaging - Crop Image in C#.NET

Visual C# .NET Image Cropping Library Control to Crop Image, Picture or Photo

Visual C#
Home > .NET Imaging SDK > C# > Crop Image
If this is your first time to use our DocImageSDK, we strongly suggest you reading How to Start first!

C# Image Cropping Control Overview
This C#.NET image crop toolkit from RasterEdge image editor SDK is a professional image cropping tool, which can help .NET developers crop image, picture or photo by Visual C# programming code. Using RasterEdge C#.NET image cropping library control, you can easily crop a rectangular section from source image object and save cropped image as a new file in .NET developing applications.
Apart from this mature imaging effect to crop target image file, RasterEdge DocImage SDK for .NET also offers other popular .NET image editing solutions, which can successfully solve the following image processing problems, like how to resize image using C# code, how to mirror image using C#.NET, how to rotate image object in C#.NET class application and how to watermark image by C# code.
This online tutorial for C#.NET image cropping application will offer guidance for C# developers from following several aspects.
  • Benefit list of this C#.NET image cropping library control
  • How to integrate RasterEdge image cropping SDK into C#.NET class application
  • C# method to crop image or picture in .NET developing environment
  • How to crop image using sample C# code
  • C#.NET image cropping SDK FAQs
C# Image Cropping Control Features
  • Written in managed C# code and independent from other external image editing software
  • Accurately decide the cropping section using the application of X / Y location by C# code
  • Cropped image part will be saved as a new image object using C# code
  • Cropped image object has the same imaging quality with original source file in C#.NET class application
Crop Image in C#.NET Application
If you are wondering how to start a Visual C# .NET image cropping application using RasterEdge C# image cropping component SDK, please read following step-by-step guidance for how to integrate RasterEdge image cropping component toolkit into your C#.NET class project.
  1. The first thing you should do is to check whether you have installed Visual Studio 2005 (or above versions) and .NET Framework 2.0 (or greater versions);
  2. Download and unzip RasterEdge DocImage SDK for .NET which contains this C#.NET image cropping add-on;
  3. Find following dlls from above downloaded trial package and integrate them into your C# class project as assemblies;
    • RasterEdge.Imaging.Basic.dll
    • RasterEdge.Imaging.Processing.dll
  4. Then please activate the evaluation license key of this C#.NET image cropping add-on and copy created "RasterEdgeLicense.txt" to your C# bin folder. What should be noted here is that each computer can activate this evaluation license key only twice;
  5. Define the Namespace of RasterEdge C#.NET image cropping tool SDK;
  6. Copy and paste the sample C# code (which is listed in following section);
  7. Now you are free to crop image from source file with desired size and location.
If you need VB.NET image cropping guide, please see Crop Image in VB.NET class application.
Visual C#.NET Image Cropping Method
Using the method that RasterEdge C#.NET image crop control SDK has adopted, C# developers can easily crop a desired rectangular section from original image object by specifying an X & Y location and a given size. The X & Y location will determine the point where the cropping action will start and the width & height value will decide how large the cropped image will be.
public static int ApplyCrop(REImage img, int x, int y, int width, int height);
Sample C# Code to Crop Image in .NET
In this part, we will give you a Visual C# programming example to illustrate how to use RasterEdge image cropping library add-on for image cropping by C# code.
using RasterEdge.Imaging.Basic;
using RasterEdge.Imaging.Basic.Core;
using RasterEdge.Imaging.Processing;
using RasterEdge.Imaging.Basic.Codec;

namespace RE__Test
public partial class Form1 : Form
public Form1()

private void button1_Click(object sender, EventArgs e)
string fileName = "c:/Sample.png";

REImage reImage = REFile.OpenImageFile(fileName);

ImageProcessing.ApplyCrop(reImage, 80, 80, 500, 500);

REFile.SaveImageFile(reImage, "c:/reimage.png", new PNGEncoder());
C# Image Cropping Control FAQs
Q: Does RasterEdge C#.NET image crop control allow developers to crop an irregular part from source image file?
A: Sorry, currently, this .NET image cropping library control only supports cropping rectangular section from source image object by Visual C# code.
More Related C# Imaging Functions

Recommend this to Google+