DicomImageCrop Method (Int32, Int32, Int32, Int32)
Crop image with shifts.

Namespace: Aspose.Imaging.FileFormats.Dicom
Assembly: Aspose.Imaging (in Aspose.Imaging.dll) Version: 20.06
Syntax
public override void Crop(
	int leftShift,
	int rightShift,
	int topShift,
	int bottomShift
)

Parameters

leftShift
Type: SystemInt32
The left shift.
rightShift
Type: SystemInt32
The right shift.
topShift
Type: SystemInt32
The top shift.
bottomShift
Type: SystemInt32
The bottom shift.
Examples
The following example crops a DICOM image. The cropping area is specified via Left, Top, Right, Bottom margins.
[C#]

string dir = @"c:\temp\";

using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.dicom"))
{
    Aspose.Imaging.FileFormats.Dicom.DicomImage dicomImage = (Aspose.Imaging.FileFormats.Dicom.DicomImage)image;

    // Crop again. Set a margin of 10% of the image size.
    int horizontalMargin = dicomImage.Width / 10;
    int verticalMargin = dicomImage.Height / 10;
    dicomImage.Crop(horizontalMargin, horizontalMargin, verticalMargin, verticalMargin);

    // Save the cropped image to PNG.
    dicomImage.Save(dir + "sample.Crop.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
See Also