RasterImage.Crop

Crop(Rectangle)

Ritaglia il rettangolo specificato.

public virtual void Crop(Rectangle rectangle)
ParametroTipoDescrizione
rectangleRectangleIl rettangolo.

Esempi

L’esempio di codice seguente mostra come ritagliare un’immagine e salvarla.

[C#]

// Implementa il metodo Crop corretto per i file PSD.
string sourceFileName = "1.psd";
string exportPathPsd = "CropTest.psd";
string exportPathPng = "CropTest.png";
using (RasterImage image = Image.Load(sourceFileName) as RasterImage)
{
    image.Crop(new Rectangle(10, 30, 100, 100));
    image.Save(exportPathPsd, new PsdOptions());
    image.Save(exportPathPng, new PngOptions() { ColorType = PngColorType.TruecolorWithAlpha });
}

Guarda anche


Crop(int, int, int, int)

Ritaglia l’immagine con spostamenti.

public virtual void Crop(int leftShift, int rightShift, int topShift, int bottomShift)
ParametroTipoDescrizione
leftShiftInt32Il turno di sinistra.
rightShiftInt32Il turno giusto.
topShiftInt32Il turno superiore.
bottomShiftInt32Lo spostamento in basso.

Guarda anche