Bildausschnitt einer PSD-Datei beim Konvertieren in PNG zuschneiden in C#
Contents
[
Hide
]
Mit Aspose.PSD für .NET können Entwickler das PSD-Bild zuschneiden, während es in Rasterformat konvertiert wird. In diesem Thema wird der Ansatz erläutert, um vorhandene Bilder zu laden, diese zuzuschneiden und in Rasterformat zu konvertieren.
Bildausschnitt einer PSD-Datei beim Konvertieren in PNG
Der unten bereitgestellte Beispielcode zeigt, wie das PSD-Bild zugeschnitten wird, während es in PNG konvertiert wird.
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 }); | |
} |