TiffImageCrop Method (Int32, Int32, Int32, Int32) |
Crop image with shifts.
Namespace: Aspose.Imaging.FileFormats.TiffAssembly: Aspose.Imaging (in Aspose.Imaging.dll) Version: 21.04
Syntaxpublic override void Crop(
int leftShift,
int rightShift,
int topShift,
int bottomShift
)
Public Overrides Sub Crop (
leftShift As Integer,
rightShift As Integer,
topShift As Integer,
bottomShift As Integer
)
public:
virtual void Crop(
int leftShift,
int rightShift,
int topShift,
int bottomShift
) override
abstract Crop :
leftShift : int *
rightShift : int *
topShift : int *
bottomShift : int -> unit
override Crop :
leftShift : int *
rightShift : int *
topShift : int *
bottomShift : int -> unit
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.
ExamplesThe following example crops a TIFF 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.tif"))
{
Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;
int horizontalMargin = tiffImage.Width / 10;
int verticalMargin = tiffImage.Height / 10;
tiffImage.Crop(horizontalMargin, horizontalMargin, verticalMargin, verticalMargin);
tiffImage.Save(dir + "sample.Crop.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
See Also