Catatan Rilis Aspose.PSD untuk .NET 20.5
Kunci | Ringkasan | Kategori |
---|---|---|
PSDNET-595 | Dukungan untuk Layer Masks untuk Layer Groups | Fitur |
PSDNET-201 | Dukungan untuk kemajuan konversi dokumen | Fitur |
PSDNET-275 | Dukungan untuk Sumber Daya Nvrt (Sumber Daya Lapisan Penyesuaian Invert) | Fitur |
PSDNET-124 | Dukungan untuk penyimpanan Gambar PSD Mode Warna Grayscale dengan 16 bit per channel | Fitur |
PSDNET-589 | Refaktorisasi Contoh di GitHub | Peningkatan |
PSDNET-587 | Penyelarasan Teks melalui ITextPortion tidak berfungsi untuk bahasa kanan-ke-kiri. Berkas output rusak. | Bug |
PSDNET-604 | Pengecualian saat mencoba membuka file Psd tertentu dengan Warna Lab dan 8 bit/channel | Bug |
PSDNET-598 | Perbaikan penyimpanan gambar PSD dengan Mode Warna Grayscale 16 bit per channel menjadi format PSD Grayscale 8 bit per channel | Bug |
PSDNET-599 | Perbaikan penyimpanan gambar PSD dengan Mode Warna Grayscale 16 bit per channel menjadi format PSD RGB 16 bit per channel | Bug |
Perubahan API Publik
API yang Ditambahkan:
- Tidak ada
API yang Dihapus:
- Tidak ada
Contoh Penggunaan:
PSDNET-595. Dukungan untuk Layer Masks untuk Layer Groups
string srcFile = "psdnet595.psd";
string outputPng = "output.png";
string outputPsd = "output.psd";
using (var input = (PsdImage)Image.Load(srcFile))
{
input.Save(outputPng, new PngOptions());
input.Save(outputPsd);
}
PSDNET-201. Dukungan untuk kemajuan konversi dokumen
string sourceFilePath = "Apple.psd";
Stream outputStream = new MemoryStream();
ProgressEventHandler localProgressEventHandler = delegate(ProgressEventHandlerInfo progressInfo)
{
string message = string.Format(
"{0} {1}: {2} dari {3}",
progressInfo.Description,
progressInfo.EventType,
progressInfo.Value,
progressInfo.MaxValue);
Console.WriteLine(message);
};
Console.WriteLine("---------- Memuat Apple.psd ----------");
var loadOptions = new PsdLoadOptions() { ProgressEventHandler = localProgressEventHandler };
using (PsdImage image = (PsdImage)Image.Load(sourceFilePath, loadOptions))
{
Console.WriteLine("---------- Menyimpan Apple.psd ke format PNG ----------");
image.Save(
outputStream,
new PngOptions()
{
ColorType = PngColorType.Truecolor, ProgressEventHandler = localProgressEventHandler
});
Console.WriteLine("---------- Menyimpan Apple.psd ke format PSD ----------");
image.Save(
outputStream,
new PsdOptions()
{
ColorMode = ColorModes.Rgb,
ChannelsCount = 4,
ProgressEventHandler = localProgressEventHandler
});
}
PSDNET-275. Dukungan untuk Sumber Daya Nvrt (Sumber Daya Lapisan Penyesuaian Invert)
using (var psdImage = (PsdImage)Image.Load("InvertAdjustmentLayer.psd"))
{
foreach (var layer in psdImage.Layers)
{
if (layer is InvertAdjustmentLayer)
{
foreach (var layerResource in layer.Resources)
{
if (layerResource is NvrtResource)
{
// Sumber Daya Nvrt didukung.
var resource = (NvrtResource)layerResource;
break;
}
}
}
}
}
PSDNET-124. Perbaikan penyimpanan gambar PSD dengan Mode Warna Grayscale 16 bit per channel menjadi format Grayscale PSD 8 bit per channel
void SaveToPsdThenLoadAndSaveToPng(
string file,
ColorModes colorMode,
short channelBitsCount,
short channelsCount,
CompressionMethod compression,
int layerNumber)
{
string filePath = file + ".psd";
string postfix = colorMode.ToString() + channelBitsCount + "_" + channelsCount + "_" + compression;
string exportPath = @"Output\" + file + postfix + ".psd";
PsdOptions psdOptions = new PsdOptions()
{
ColorMode = colorMode,
ChannelBitsCount = channelBitsCount,
ChannelsCount = channelsCount,
CompressionMethod = compression
};
using (PsdImage image = (PsdImage)Image.Load(filePath))
{
RasterCachedImage raster = layerNumber >= 0 ? (RasterCachedImage)image.Layers[layerNumber] : image;
Aspose.PSD.Graphics graphics = new Graphics(raster);
int width = raster.Width;
int height = raster.Height;
Rectangle rect = new Rectangle(
width / 3,
height / 3,
width - (2 * (width / 3)) - 1,
height - (2 * (height / 3)) - 1);
graphics.DrawRectangle(new Aspose.PSD.Pen(Color.DarkGray, 1), rect);
image.Save(exportPath, psdOptions);
}
string pngExportPath = Path.ChangeExtension(exportPath, "png");
using (PsdImage image = (PsdImage)Image.Load(exportPath))
{
// Harus tidak ada pengecualian.
image.Save(pngExportPath, new PngOptions() { ColorType = PngColorType.GrayscaleWithAlpha });
}
}
SaveToPsdThenLoadAndSaveToPng("grayscale5x5", ColorModes.Cmyk, 16, 5, CompressionMethod.RLE, 0);
SaveToPsdThenLoadAndSaveToPng("argb16bit_5x5", ColorModes.Grayscale, 16, 2, CompressionMethod.RLE, 0);
SaveToPsdThenLoadAndSaveToPng("argb16bit_5x5_no_layers", ColorModes.Grayscale, 16, 2, CompressionMethod.RLE, -1);
SaveToPsdThenLoadAndSaveToPng("argb8bit_5x5", ColorModes.Grayscale, 16, 2, CompressionMethod.RLE, 0);
SaveToPsdThenLoadAndSaveToPng("argb8bit_5x5_no_layers", ColorModes.Grayscale, 16, 2, CompressionMethod.RLE, -1);
SaveToPsdThenLoadAndSaveToPng("cmyk16bit_5x5_no_layers", ColorModes.Grayscale, 16, 2, CompressionMethod.RLE, -1);
SaveToPsdThenLoadAndSaveToPng("index8bit_5x5", ColorModes.Grayscale, 16, 2, CompressionMethod.RLE, -1);
PSDNET-587. Penyelarasan Teks melalui ITextPortion tidak berfungsi untuk bahasa kanan-ke-kiri. Berkas output rusak.
string sourceFileName = "bidi.psd";
string outputFileName = "bidiOutput.psd";
using (PsdImage image = (PsdImage)Image.Load(sourceFileName))
{
var layer = (TextLayer)image.Layers[2];
var portions = layer.TextData.Items;
portions[0].Paragraph.Justification = 2;
layer.TextData.UpdateLayerData();
image.Save(outputFileName);
}
PSDNET-604. Pengecualian saat mencoba membuka file Psd tertentu dengan Warna Lab dan 8 bit/channel
string srcFile = "Untitled-1.psd";
string outputFilePsd = "output.psd";
using (var psdImage = (PsdImage)Image.Load(srcFile))
{
psdImage.Save(outputFilePsd);
}
// File LAB dimuat dan disimpan tanpa melemparkan pengecualian.
PSDNET-598. Perbaikan penyimpanan gambar PSD dengan Mode Warna Grayscale 16 bit per channel menjadi format Grayscale 8 bit per channel PSD
string sourceFileName = "grayscale16bit.psd";
string exportFileName = "grayscale16bit_output.psd";
PsdOptions psdOptions = new PsdOptions()
{
ColorMode = ColorModes.Grayscale,
ChannelBitsCount = 8,
ChannelsCount = 2
};
using (PsdImage image = (PsdImage)Image.Load(sourceFileName))
{
RasterCachedImage raster = image.Layers[0];
Aspose.PSD.Graphics graphics = new Graphics(raster);
int width = raster.Width;
int height = raster.Height;
Rectangle rect = new Rectangle(width / 3, height / 3, width - (2 * (width / 3)) - 1, height - (2 * (height / 3)) - 1);
graphics.DrawRectangle(new Aspose.PSD.Pen(Color.DarkGray, 1), rect);
image.Save(exportFileName, psdOptions);
}
string pngExportPath = Path.ChangeExtension(exportFileName, "png");
using (PsdImage image = (PsdImage)Image.Load(exportFileName))
{
// Harus tidak ada pengecualian.
image.Save(pngExportPath, new PngOptions() { ColorType = PngColorType.GrayscaleWithAlpha });
}
PSDNET-599. Perbaikan penyimpanan gambar PSD dengan Mode Warna Grayscale 16 bit per channel menjadi format PSD RGB 16 bit per channel
string sourceFileName = "grayscale16bit.psd";
string exportFileName = "grayscale16bit_output.psd";
PsdOptions psdOptions = new PsdOptions()
{
ColorMode = ColorModes.Rgb,
ChannelBitsCount = 8,
ChannelsCount = 4
};
using (PsdImage image = (PsdImage)Image.Load(sourceFileName))
{
RasterCachedImage raster = image.Layers[0];
Aspose.PSD.Graphics graphics = new Graphics(raster);
int width = raster.Width;
int height = raster.Height;
Rectangle rect = new Rectangle(width / 3, height / 3, width - (2 * (width / 3)) - 1, height - (2 * (height / 3)) - 1);
graphics.DrawRectangle(new Aspose.PSD.Pen(Color.DarkGray, 1), rect);
image.Save(exportFileName, psdOptions);
}
string pngExportPath = Path.ChangeExtension(exportFileName, "png");
using (PsdImage image = (PsdImage)Image.Load(exportFileName))
{
// Harus tidak ada pengecualian.
image.Save(pngExportPath, new PngOptions() { ColorType = PngColorType.GrayscaleWithAlpha });
}