---
title: "Crop"
canonical: https://www.graphicsmill.com/samples/LargeImages/Transforms/Crop_cs
product: "Graphics Mill"
source: "LargeImages/Transforms/Crop.cs"
---

# Crop

Crops image using memory-friendly Pipeline API.

## Instruction

Crop an image to a specified rectangular area and save the result.

## Usings

```csharp
using Aurigma.GraphicsMill.Codecs;
using Aurigma.GraphicsMill.Transforms;
```

## Code Snippet

```csharp
using (var reader = ImageReader.Create("Chicago.jpg"))
using (var crop = new Crop(200, 150, 360, 270))
using (var writer = ImageWriter.Create("PipelineCrop1.jpg"))
{
    Pipeline.Run(reader + crop + writer);
}
```

## Explanation

The code:

- Reads the image.
- Crops the image to a rectangle with the specified dimensions (200, 150, 360, 270).
- Saves the cropped image to the specified file.

## Tags

- [Crop](<https://www.graphicsmill.com/samples/tags/crop_md>): Cropping images
- [Pipeline](<https://www.graphicsmill.com/samples/tags/pipeline_md>): Working with images via the Pipeline API

## Input

- [Chicago.jpg](<https://www.graphicsmill.com/samples/LargeImages/compiled/Debug/Chicago_jpg>) (preview)

## Output

- [PipelineCrop1.jpg](<https://www.graphicsmill.com/samples/LargeImages/compiled/Debug/PipelineCrop1_jpg>) (preview)

## Used APIs

- [Aurigma.GraphicsMill.Codecs.ImageReader](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Codecs_ImageReader.htm.md>)
- [Aurigma.GraphicsMill.Codecs.ImageReader.Create(String)](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Codecs_ImageReader_Create_1_bb3a7a4f.htm.md>)
- [Aurigma.GraphicsMill.Codecs.ImageWriter](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Codecs_ImageWriter.htm.md>)
- [Aurigma.GraphicsMill.Codecs.ImageWriter.Create(String)](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Codecs_ImageWriter_Create_1_bb3a7a4f.htm.md>)
- [Aurigma.GraphicsMill.Transforms.Crop](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Transforms_Crop.htm.md>)
