قص ملف PSD أثناء التحويل إلى PNG
Contents
[
Hide
]
باستخدام Aspose.PSD لـ Java ، يمكن للمطورين قص صورة 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
String dataDir = Utils.getDataDir(CropPSDFile.class) + "Conversion/"; | |
// Implement correct Crop method for PSD files. | |
String sourceFileName = dataDir + "1.psd"; | |
String exportPathPsd = dataDir + "CropTest.psd"; | |
String exportPathPng = dataDir + "CropTest.png"; | |
try (RasterImage image = (RasterImage) Image.load(sourceFileName)) { | |
image.crop(new Rectangle(10, 30, 100, 100)); | |
image.save(exportPathPsd, new PsdOptions()); | |
PngOptions options = new PngOptions(); | |
options.setColorType(PngColorType.TruecolorWithAlpha); | |
image.save(exportPathPng, options); | |
} |