Ritaglio file PSD durante la conversione in PNG in C#
Contents
[
Hide
]
Utilizzando Aspose.PSD per .NET, gli sviluppatori possono ritagliare l’immagine PSD mentre la convertono nel formato raster. Questo argomento spiega l’approccio per caricare immagini esistenti, ritagliarle e convertirle nel formato raster.
Ritaglio file PSD durante la conversione in PNG
Il codice di esempio fornito di seguito dimostra come ritagliare l’immagine PSD durante la conversione in PNG.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-psd/Aspose.PSD-for-.NET | |
string sourceFileName = dataDir + "1.psd"; | |
string exportPathPsd = dataDir + "CropTest.psd"; | |
string exportPathPng = dataDir + "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 }); | |
} |