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
Assembly: Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)

Syntax

C#
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) method.
bitmap

Type: Aurigma.GraphicsMill.Bitmap

A Bitmap to place at the given position.

Examples

C#
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

Manual