翻譯|產(chǎn)品更新|編輯:李顯亮|2020-07-03 10:43:31.740|閱讀 425 次
概述:Aspose.PSD for .Net更新至新版本v20.6,支持LnkE資源,支持britResource(亮度/對比度調整層資源),同時將DefaultReplacementFont設置移到ImageOptionsBase類中,歡迎下載體驗。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
Aspose.PSD for .Net是高級PSD和入門級AI文件格式操作API,允許創(chuàng)建和編輯Photoshop文件,并提供更新圖層屬性,添加水印,執(zhí)行圖形操作或將一種文件格式轉換為另一種文件的功能,沒有任何Adobe Photoshop或Adobe Illustrator依賴項。
令人興奮的是,.NET版Aspose.PSD迎來了6月的最新更新!新增了如下兩大新功能:
>>你可以點擊這里下載Aspose.PSD for .NET v20.6測試體驗
key | 概述 | 類別 |
---|---|---|
PSDNET-606 | 支持LnkE資源 | 新功能 |
PSDNET-386 | 支持britResource(亮度/對比度調整層資源) | 新功能 |
PSDNET-219 | 將DefaultReplacementFont設置移到ImageOptionsBase類中 | 增強功能 |
PSDNET-596 | 沒有渲染沒有通過穿透混合模式的圖層組 | Bug修復 |
PSDNET-610 | 嘗試將特定的Psd文件轉換為圖像時出現(xiàn)NullReference異常 | Bug修復 |
PSDNET-636 | 如果調整圖層中的蒙版具有空白邊界,則調整PSD文件的大小將無法正常工作 | Bug修復 |
PSDNET-611 | 嘗試打開特定的Psd文件時發(fā)生OverflowException | Bug修復 |
PSDNET-565 | 具有RGB模式16位/通道的Psd圖像僅在預覽時更新圖層 | Bug修復 |
PSDNET-652 | 使用復合LnkE資源和adobeStockLicenseState屬性加載特定PSD文件時發(fā)生異常 | Bug修復 |
PSDNET-640 | PSD圖層蒙版更改在保存時被丟棄 | Bug修復 |
PSDNET-593 | 將AI文件保存為Jpeg2000格式不起作用 | Bug修復 |
PSDNET-638 | 將圖層組添加到空圖層組后,圖層順序不正確 | Bug修復 |
string message = "ExampleOfLnkEResourceSupport works incorrectly."; void AssertIsTrue(bool condition) { if (!condition) { throw new FormatException(message); } } void AssertAreEqual(object actual, object expected) { if (!object.Equals(actual, expected)) { throw new FormatException(message); } } // This example demonstrates how to get and set properties of the Photoshop Psd LnkE Resource that contains information about an external linked file. void ExampleOfLnkEResourceSupport( string filePath, int length, int length2, int length3, int length4, string fullPath, string date, double assetModTime, string childDocId, bool locked, string uid, string name, string originalFileName, string fileType, long size) { string fileName = Path.GetFileName(filePath); string outputPath = @"Output\" + fileName; using (PsdImage image = (PsdImage)Image.Load(filePath)) { LnkeResource lnkeResource = null; foreach (var resource in image.GlobalLayerResources) { lnkeResource = resource as LnkeResource; if (lnkeResource != null) { AssertAreEqual(lnkeResource.Length, length); AssertAreEqual(lnkeResource.UniqueId, new Guid(uid)); AssertAreEqual(lnkeResource.FullPath, fullPath); AssertAreEqual(lnkeResource.Date.ToString(CultureInfo.InvariantCulture), date); AssertAreEqual(lnkeResource.AssetModTime, assetModTime); AssertAreEqual(lnkeResource.AssetLockedState, locked); AssertAreEqual(lnkeResource.FileName, name); AssertAreEqual(lnkeResource.FileSize, size); AssertAreEqual(lnkeResource.ChildDocId, childDocId); AssertAreEqual(lnkeResource.Version, 7); AssertAreEqual(lnkeResource.FileType, fileType); AssertAreEqual(lnkeResource.FileCreator, string.Empty); AssertAreEqual(lnkeResource.OriginalFileName, originalFileName); AssertAreEqual(lnkeResource.CompId, -1); AssertAreEqual(lnkeResource.OriginalCompId, -1); AssertIsTrue(lnkeResource.HasFileOpenDescriptor); AssertIsTrue(!lnkeResource.IsEmpty); AssertIsTrue(lnkeResource.Type == LinkResourceType.liFE); lnkeResource.FullPath = @"file:///C:/Aspose/net/Aspose.Psd/test/testdata/Images/Psd/SmartObjects/rgb8_2x2.png"; AssertAreEqual(lnkeResource.Length, length2); lnkeResource.FileName = "rgb8_2x23.png"; AssertAreEqual(lnkeResource.Length, length3); lnkeResource.ChildDocId = Guid.NewGuid().ToString(); AssertAreEqual(lnkeResource.Length, length4); lnkeResource.Date = DateTime.Now; lnkeResource.AssetModTime = double.MaxValue; lnkeResource.FileSize = long.MaxValue; lnkeResource.FileType = "test"; lnkeResource.FileCreator = "file"; lnkeResource.CompId = int.MaxValue; break; } } AssertIsTrue(lnkeResource != null); image.Save(outputPath, new PsdOptions(image)); } using (PsdImage image = (PsdImage)Image.Load(outputPath)) { image.Save( Path.ChangeExtension(outputPath, "png"), new PngOptions { ColorType = PngColorType.TruecolorWithAlpha }); } } // This example demonstrates how to get and set properties of the Psd LnkE Resource that contains information about external linked JPEG file. this.ExampleOfLnkEResourceSupport( @"..\..\..\Issues\IMAGINGNET-2375\photooverlay_5_new.psd", 0x21c, 0x26c, 0x274, 0x27c, @"file:///C:/Users/cvallejo/Desktop/photo.jpg", "05/09/2017 22:24:51", 0, "F062B9DB73E8D124167A4186E54664B0", false, "02df245c-36a2-11e7-a9d8-fdb2b61f07a7", "photo.jpg", "photo.jpg", "JPEG", 0x1520d); // This example demonstrates how to get and set properties of the PSD LnkE Resource that contains information about an external linked PNG file. this.ExampleOfLnkEResourceSupport( "rgb8_2x2_linked.psd", 0x284, 0x290, 0x294, 0x2dc, @"file:///C:/Aspose/net/Aspose.Psd/test/testdata/Issues/PSDNET-491/rgb8_2x2.png", "04/14/2020 14:23:44", 0, "", false, "5867318f-3174-9f41-abca-22f56a75247e", "rgb8_2x2.png", "rgb8_2x2.png", "png", 0x53); // This example demonstrates how to get and set properties of the Photoshop Psd LnkE Resource that contains information about an external linked CC Libraries Asset. this.ExampleOfLnkEResourceSupport( "rgb8_2x2_asset_linked.psd", 0x398, 0x38c, 0x388, 0x3d0, @"CC Libraries Asset “rgb8_2x2_linked/rgb8_2x2” (Feature is available in Photoshop CC 2015)", "01/01/0001 00:00:00", 1588890915488.0d, "", false, "ec15f0a8-7f13-a640-b928-7d29c6e9859c", "rgb8_2x2_linked", "rgb8_2x2.png", "png", 0);
string sourceFilePath = "Apple.psd"; Stream outputStream = new MemoryStream(); ProgressEventHandler localProgressEventHandler = delegate(ProgressEventHandlerInfo progressInfo) { string message = string.Format( "{0} {1}: {2} out of {3}", progressInfo.Description, progressInfo.EventType, progressInfo.Value, progressInfo.MaxValue); Console.WriteLine(message); }; Console.WriteLine("---------- Loading Apple.psd ----------"); var loadOptions = new PsdLoadOptions() { ProgressEventHandler = localProgressEventHandler }; using (PsdImage image = (PsdImage)Image.Load(sourceFilePath, loadOptions)) { Console.WriteLine("---------- Saving Apple.psd to PNG format ----------"); image.Save( outputStream, new PngOptions() { ColorType = PngColorType.Truecolor, ProgressEventHandler = localProgressEventHandler }); Console.WriteLine("---------- Saving Apple.psd to PSD format ----------"); image.Save( outputStream, new PsdOptions() { ColorMode = ColorModes.Rgb, ChannelsCount = 4, ProgressEventHandler = localProgressEventHandler }); }
/* This Example demonstrates how you can programmatically change the PSD Image Brightness/Contrast Layer Resource - BritResource This is a Low-Level Aspose.PSD API. You can use Brightness/Contrast Layer through its API, which will be much easier, but direct PhotoShop resource editing gives you more control over the PSD file content. */ string path = @"BrightnessContrastPS6.psd"; string outputPath = @"BrightnessContrastPS6_output.psd"; using (PsdImage im = (PsdImage)Image.Load(path)) { foreach (var layer in im.Layers) { if (layer is BrightnessContrastLayer) { foreach (var layerResource in layer.Resources) { if (layerResource is BritResource) { var resource = (BritResource)layerResource; isRequiredResourceFound = true; if (resource.Brightness != -40 || resource.Contrast != 10 || resource.LabColor != false || resource.MeanValueForBrightnessAndContrast != 127) { throw new Exception("BritResource was read wrong"); } // Test editing and saving resource.Brightness = 25; resource.Contrast = -14; resource.LabColor = true; resource.MeanValueForBrightnessAndContrast = 200; im.Save(outputPath, new PsdOptions()); break; } } } } }
// Please, don't intall Konstanting Font, because this test should replace font that is not installed string sourceFileName = "sample_konstanting.psd"; string[] outputs = new string[] { "replacedfont0.tiff", "replacedfont1.png", "replacedfont2.jpg" }; using (PsdImage image = (PsdImage)Image.Load(sourceFileName, new PsdLoadOptions())) { // This way you can use different fonts for different outputs image.Save(outputs[0], new TiffOptions(TiffExpectedFormat.TiffJpegRgb) { DefaultReplacementFont = "Arial" }); image.Save(outputs[1], new PngOptions { DefaultReplacementFont = "Verdana" }); image.Save(outputs[2], new JpegOptions { DefaultReplacementFont = "Times New Roman" }); }
本站文章除注明轉載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn