---
title: "LosslessJpegTransform..::.AlignToSampleSize Method (Point, Bitmap)"
canonical: https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Codecs_LosslessJpegTransform_AlignToSampleSize_2_53be7bca.htm
product: "Graphics Mill 5.5 for .NET"
---

This documentation is for the old version. [Go to the latest Graphics Mill docs](https://www.graphicsmill.com/docs/gm/)

# LosslessJpegTransform.AlignToSampleSize Method (Point, Bitmap)
 
Aligns coordinates of the point and bitmap to the JPEG sample size.
 
**Namespace:** [Aurigma.GraphicsMill.Codecs](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill_Codecs.htm.md)
 **Assembly:** Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)
 
## Syntax
  
```
Public Function AlignToSampleSize ( _offset As Point, _bitmap As Bitmap _
) As Rectangle
```
 
```csharp
public Rectangle AlignToSampleSize(Point offset,Bitmap bitmap
)
```
 
### Parameters
 
 - offset
     - Type: [System.Drawing.Point](http://msdn2.microsoft.com/en-us/bk9hwzbw)
 [Point](http://msdn2.microsoft.com/en-us/bk9hwzbw) at which the *bitmap* should be placed. It will be used as a location of left top corner of the input rectangle.

 - bitmap
     - Type: [Aurigma.GraphicsMill.Bitmap](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Bitmap.htm.md)
 [Bitmap](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Bitmap.htm.md) class instance which specifies a bitmap. Its width and height will be used as dimensions of the input rectangle.
 
### Return Value
 [Rectangle](http://msdn2.microsoft.com/en-us/1zk39146) which contains coordinates aligned to JPEG sample size. It is always greater or equal than the input rectangle formed by the *offset* and dimensions of the *bitmap*.
 
## Remarks
 This method is used when you need overwrite some portion of JPEG file by some bitmap. Since JPEG compressed data is stored in blocks (samples) of several pixels (typically 8, 16, or other number divisible by 8), you cannot write bitmap by arbitrary coordinates. That's why you need to align coordinates by the JPEG sample size.
   
## See Also

### Reference

- [LosslessJpegTransform Class](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_LosslessJpegTransform.htm.md)
- [AlignToSampleSize Overload](https://www.graphicsmill.com/docs/gm5/O_T_Aurigma_GraphicsMill_Codecs_LosslessJpegTransform_AlignToSampleSize.htm.md)
- [Aurigma.GraphicsMill.Codecs Namespace](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill_Codecs.htm.md)
- [LosslessJpegTransform.WriteCropped(String, Rectangle)](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Codecs_LosslessJpegTransform_WriteCropped_2_45371d77.htm.md)
- [LosslessJpegTransform.WritePatched(String, Point, Bitmap)](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Codecs_LosslessJpegTransform_WritePatched_3_f5f3fae2.htm.md)
