Halaman ini berisi catatan rilis untuk Aspose.PSD for Java 23.8
Kunci | Ringkasan | Kategori |
---|---|---|
PSDJAVA-518 | Menambahkan jenis warp baru (Bendera) | Fitur |
PSDJAVA-519 | Menambahkan jenis warp baru: busur atas, busur bawah, bola | Fitur |
PSDJAVA-520 | Mengimplementasikan metode baru PsdImage.AddPosterizeAdjustmentLayer untuk menambahkan lapisan Posterize baru | Fitur |
PSDJAVA-521 | Informasi PSD hilang saat hanya membuka dan menyimpan | Bug |
PSDJAVA-522 | Gagal memuat gambar | Bug |
PSDJAVA-523 | Gagal memuat gambar: Tidak dapat mengonversi objek tipe UnknownStructure menjadi tipe DescriptorStructure | Bug |
PSDJAVA-524 | Berkas berubah dalam pustaka pihak ketiga merusak berkas PSD tetapi bisa dibuka di Photoshop | Bug |
Perubahan API Publik
API Ditambahkan:
- M:com.aspose.psd.fileformats.psd.PsdImage.addPosterizeAdjustmentLayer
API Dihapus:
- Tidak ada
Contoh Penggunaan:
PSDJAVA-518. Menambahkan jenis warp baru (Bendera)
String sourceFile = "src/main/resources/flag_warp.psd";
String outputFile = "src/main/resources/flag_export.png";
PsdLoadOptions psdLoadOptions = new PsdLoadOptions();
psdLoadOptions.setAllowWarpRepaint(true);
psdLoadOptions.setLoadEffectsResource(true);
try (PsdImage psdImage = (PsdImage) Image.load(sourceFile, psdLoadOptions)) {
PngOptions pngOptions = new PngOptions();
pngOptions.setColorType(PngColorType.TruecolorWithAlpha);
psdImage.save(outputFile, pngOptions);
}
PSDJAVA-519. Menambahkan jenis warp baru: busur atas, busur bawah, bola
String sourceFileArcUpper = "src/main/resources/arc_upper_warp.psd";
String sourceFileArcLower = "src/main/resources/arc_lower_warp.psd";
String sourceFileBulge = "src/main/resources/bulge_warp.psd";
String outputFileArcUpper = "src/main/resources/ArcUpper_export.png";
String outputFileArcLower = "src/main/resources/ArcLower_export.png";
String outputFileBulge = "src/main/resources/Bulge_export.png";
PsdLoadOptions psdLoadOptions = new PsdLoadOptions();
psdLoadOptions.setAllowWarpRepaint(true);
psdLoadOptions.setLoadEffectsResource(true);
PngOptions pngOptions = new PngOptions();
pngOptions.setColorType(PngColorType.TruecolorWithAlpha);
try (PsdImage psdImage = (PsdImage) Image.load(sourceFileArcUpper, psdLoadOptions)) {
psdImage.save(outputFileArcUpper, pngOptions);
}
try (PsdImage psdImage = (PsdImage) Image.load(sourceFileArcLower, psdLoadOptions)) {
psdImage.save(outputFileArcLower, pngOptions);
}
try (PsdImage psdImage = (PsdImage) Image.load(sourceFileBulge, psdLoadOptions)) {
psdImage.save(outputFileBulge, pngOptions);
}
PSDJAVA-520. Melaksanakan metode baru PsdImage.AddPosterizeAdjustmentLayer untuk menambahkan lapisan Posterize baru
public static void main(String[] args) {
String srcFile = "src/main/resources/zendeya.psd";
String outFile = "src/main/resources/zendeya.psd.out.psd";
try (PsdImage psdImage = (PsdImage) Image.load(srcFile)) {
psdImage.addPosterizeAdjustmentLayer();
psdImage.save(outFile);
}
PsdLoadOptions psdLoadOptions = new PsdLoadOptions();
psdLoadOptions.setLoadEffectsResource(true);
// Periksa perubahan yang disimpan
try (PsdImage image = (PsdImage) Image.load(outFile, psdLoadOptions)) {
assertAreEqual(2, image.getLayers().length);
PosterizeLayer posterizeLayer = (PosterizeLayer) image.getLayers()[1];
assertAreEqual(true, posterizeLayer instanceof PosterizeLayer);
}
}
static void assertAreEqual(Object expected, Object actual) {
assertAreEqual(expected, actual, "Objek tidak sama.");
}
static void assertAreEqual(Object expected, Object actual, String message) {
if (!expected.equals(actual)) {
throw new IllegalArgumentException(message);
}
}
PSDJAVA-521. Informasi PSD hilang saat hanya membuka dan menyimpan
String src = "src/main/resources/Original file.psd";
String outputPsd = "src/main/resources/out_Original file.psd";
String outputPng = "src/main/resources/out_Original file.png";
try (PsdImage psdImage = (PsdImage) Image.load(src)) {
PngOptions pngOptions = new PngOptions();
pngOptions.setColorType(PngColorType.TruecolorWithAlpha);
psdImage.save(outputPsd);
psdImage.save(outputPng, pngOptions);
}
PSDJAVA-522. Gagal memuat gambar
String srcFile1 = "src/main/resources/test_text.psd";
String srcFile2 = "src/main/resources/test_smart_object.psd";
try (PsdImage psdImage = (PsdImage) Image.load(srcFile1)) {
}
try (PsdImage psdImage = (PsdImage) Image.load(srcFile2)) {
}
PSDJAVA-523. Gagal memuat gambar: Tidak dapat mengonversi objek tipe UnknownStructure menjadi tipe DescriptorStructure
try (PsdImage newPsd = new PsdImage(10, 10)) {
newPsd.addLayer(FillLayer.createInstance(FillType.Gradient));
final MemoryStream memStream = new MemoryStream(DescriptorStructure.StructureKey + 1000);
try {
newPsd.save(memStream.toOutputStream());
memStream.seek(DescriptorStructure.StructureKey, SeekOrigin.Current);
memStream.write(new byte[1], 0, 0);
memStream.setPosition(0);
try (PsdImage psdImage = (PsdImage) Image.load(memStream.toInputStream())) {
// Seharusnya terbaca dengan benar
}
} finally {
memStream.close();
}
}
PSDJAVA-524. Berkas berubah dalam pustaka pihak ketiga merusak berkas PSD tetapi bisa dibuka di Photoshop
String sourceFile = "src/main/resources/output.psd";
String outputFile = "src/main/resources/export.png";
PsdLoadOptions psdLoadOptions = new PsdLoadOptions();
psdLoadOptions.setLoadEffectsResource(true);
try (PsdImage img = (PsdImage) Image.load(sourceFile, psdLoadOptions)) {
PngOptions pngOptions = new PngOptions();
pngOptions.setCompressionLevel(9);
pngOptions.setColorType(PngColorType.TruecolorWithAlpha);
img.save(outputFile, pngOptions);
}