Click or drag to resize

LosslessJpegCrop Method (String, String, Rectangle)

Performs a lossless crop on a JPEG image.
Performs a lossless crop on a JPEG image.

Namespace:  Atalasoft.Imaging.ImageProcessing
Assembly:  Atalasoft.dotImage (in Atalasoft.dotImage.dll) Version: 11.4.0.9.0.377 (.NET 4.5.2, x86)
Syntax
public static void Crop(
	string source,
	string dest,
	Rectangle cropRectangle
)

Parameters

source
Type: SystemString
The source image file.
dest
Type: SystemString
The destination image filename.
cropRectangle
Type: System.DrawingRectangle
The crop rectangle.
Exceptions
ExceptionCondition
Thrown is the current license is not DotImage Photo Pro, or DotImage Document Imaging.
Thrown is the current license is not DotImage Photo Pro, or DotImage Document Imaging.
Remarks

Perform a lossless crop on the image in a JPG file, without decompressing the JPG data. By not decompressing, you don't have to re-compress, thus avoiding adding additional JPG artifacts to the output image.

This works by rearranging the compressed data (DCT coefficients), without ever fully decoding the image. Therefore, its transformations are lossless: there is no image degradation at all, which is not the case if you were to read the image to RGB, transform, and save again as JPG.

Note:,JPG files are compressed in rectangular blocks. The dimensions of these blocks are always a multiple of 8 pixels: 8x8 and 16x16 are common.

Because the compression blocks on the top and left edges cannot be split during a crop, the size of these blocks affects the crops that this function can perform. This inability to split blocks means that the top-left corner of the crop rect you specify will always be rounded down to the next lowest multiple of the MCU size (see GetMcuBlackSize). The bottom right corner you specify is unaffected.

See Also