برش پرونده PSD هنگام تبدیل به PNG در C#
Contents
[
Hide
]
استفاده از Aspose.PSD برای .NET، توسعه دهندگان می توانند تصویر PSD را هنگام تبدیل به قالب رستر ببرند. این موضوع روش بارگیری تصاویر موجود، برش آنها و تبدیل به قالب رستر را توضیح می دهد.
برش پرونده PSD هنگام تبدیل به PNG
کد نمونه ارائه شده در زیر نشان می دهد چگونه تصویر PSD را هنگام تبدیل به 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 }); | |
} |