---
title: "LosslessJpeg.WritePatched Method (String, Point, Bitmap)"
canonical: https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Codecs_LosslessJpeg_WritePatched_3_f5f3fae2.htm
product: "Graphics Mill"
---

# LosslessJpeg.WritePatched Method (String, Point, Bitmap)
 
Patches the image using a given bitmap and writes the result 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 WritePatched(string fileName,Point offset,Bitmap bitmap
)
```
 
### Parameters
 
 - fileName
     - Type: System.String
The name of the file to save the result.

 - offset
     - Type: System.Drawing.Point
A Point at which the *bitmap* should be placed. Note, it should be aligned to MCU using the [AlignToMCUSize(Rectangle, JpegAlignToSampleSizeMode)](https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Codecs_LosslessJpeg_AlignToMCUSize_2_196b06b9.htm.md) method.

 - bitmap
     - Type: [Aurigma.GraphicsMill.Bitmap](https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Bitmap.htm.md)
A [Bitmap](https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Bitmap.htm.md) to place at the given position.
 
## Examples
  
```csharp
var rect = new System.Drawing.Rectangle(152, 136, 72, 32);

using (var patchBitmap = new Bitmap())
{
    //Apply crop and mosaic transfroms
    using (var input = new Bitmap(@"Images\in.jpg"))
    using (var crop = new Crop(rect))
    using (var mosaic = new Mosaic(4, 4))
    {
        Pipeline.Run(input + crop + mosaic + patchBitmap);
    }

    //Patch JPEG
    using (var losslessJpeg = new LosslessJpeg(@"Images\in.jpg"))
    {
        rect = losslessJpeg.AlignToMCUSize(rect, JpegAlignToSampleSizeMode.Patch);
        losslessJpeg.WritePatched(@"Images\Output\out.jpg", rect.Location, patchBitmap);
    }
}
```
   
## See Also

### Reference

- [LosslessJpeg Class](https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Codecs_LosslessJpeg.htm.md)
- [WritePatched Overload](https://www.graphicsmill.com/docs/gm/O_T_Aurigma_GraphicsMill_Codecs_LosslessJpeg_WritePatched.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)
