PSD Dosyasını PNG'ye Dönüştürürken PSD Dosyasını Kırpmak
Contents
[
Hide
]
Java için Aspose.PSD kullanarak, geliştiriciler PSD görüntüsünü kırpabilirken onu raster formata dönüştürebilirler. Bu konu var olan görüntüleri yükleme, kırpma ve raster formata dönüştürme yaklaşımını açıklar.
PSD Dosyasını PNG’ye Dönüştürürken PSD Dosyasını Kırpmak
Aşağıda verilen örnek kod, PSD görüntüsünü PNG’ye dönüştürürken nasıl kırılacağını gösterir.
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); | |
} |