---
title: "LosslessJpeg.WriteCropped Method (String, Rectangle)"
canonical: https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Codecs_LosslessJpeg_WriteCropped_2_45371d77.htm
product: "Graphics Mill"
---

# LosslessJpeg.WriteCropped Method (String, Rectangle)
 
Crops the image and writes it to the specified file.
 
**Namespace:** [Aurigma.GraphicsMill.Codecs](https://www.graphicsmill.com/docs/gm/N_Aurigma_GraphicsMill_Codecs.htm.md)
 **Assembly:** Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)
 
## Syntax
  
```csharp
public void WriteCropped(string fileName,Rectangle rectangle
)
```
 
### Parameters
 
 - fileName
     - Type: System.String
The name of the file to save the result.

 - rectangle
     - Type: System.Drawing.Rectangle
The cropping rectangle. The rectangle must be inside the image. Note, coordinates of this rectangle and coordinates of the cropped portion of image may be different.
 
## Examples
  
```csharp
using (var losslessJpeg = new LosslessJpeg(@"Images\in.jpg"))
{
    losslessJpeg.WriteCropped(@"Images\Output\out.jpg", new System.Drawing.Rectangle(64, 40, 157, 117));
}
```
   
## See Also

### Reference

- [LosslessJpeg Class](https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Codecs_LosslessJpeg.htm.md)
- [WriteCropped Overload](https://www.graphicsmill.com/docs/gm/O_T_Aurigma_GraphicsMill_Codecs_LosslessJpeg_WriteCropped.htm.md)
- [Aurigma.GraphicsMill.Codecs Namespace](https://www.graphicsmill.com/docs/gm/N_Aurigma_GraphicsMill_Codecs.htm.md)

### Manual

- [Applying Lossless JPEG Transforms](https://www.graphicsmill.com/docs/gm/applying-lossless-jpeg-transforms.htm.md)
