قص ملف PSD أثناء تحويله إلى PNG في C#
Contents
[
Hide
]
باستخدام Aspose.PSD for .NET ، يمكن للمطورين قص صورة PSD أثناء تحويلها إلى تنسيق بكسلي. يشرح هذا الموضوع الطريقة لتحميل الصور الحالية وقصها وتحويلها إلى تنسيق بكسلي.
قص ملف PSD أثناء تحويله إلى PNG
الشفرة البرمجية المقدمة أدناه توضح كيفية قص صورة PSD أثناء تحويلها إلى PNG.
This file contains hidden or 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 }); | |
} |