原創|產品更新|編輯:李顯亮|2021-07-19 09:37:41.793|閱讀 301 次
概述:Aspose.PSD for .Net更新至新版本v21.7,支持使用 TextPortions 進行字體編輯,添加到 Aspose.PSD .Net 5.0 配置,歡迎下載體驗。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
Aspose.PSD是高級PSD和入門級AI文件格式操作API,允許創建和編輯Photoshop文件,并提供更新圖層屬性,添加水印,執行圖形操作或將一種文件格式轉換為另一種文件的功能,沒有任何Adobe Photoshop或Adobe Illustrator依賴項。
Aspose.PSD for .Net更新至新版本v21.7,支持使用 TextPortions 進行字體編輯,添加到 Aspose.PSD .Net 5.0 配置。
>>你可以點擊這里下載Aspose.PSD for .NET v21.7試用體驗。
| key | 概述 | 類別 |
|---|---|---|
| PSDNET-806 | 支持使用 TextPortions 進行字體編輯 | 新功能 |
| PSDNET-917 | Aspose.PSD 21.6: ImageSaveException 試圖將 PSD 轉換為 PNG | Bug修復 |
| PSDNET-858 | 添加到 Aspose.PSD .Net 5.0 配置 | 增強功能 |
PSDNET-806——支持使用 TextPortions 進行字體編輯
string outputFilePng = "result_fontEditTest.png";
string outputFilePsd = "fontEditTest.psd";
void AssertAreEqual(object expected, object actual)
{
if (!object.Equals(expected, actual))
{
throw new Exception("Objects are not equal.");
}
}
using (var image = new PsdImage(500, 500))
{
FillLayer backgroundFillLayer = FillLayer.CreateInstance(FillType.Color);
((IColorFillSettings)backgroundFillLayer.FillSettings).Color = Color.White;
image.AddLayer(backgroundFillLayer);
TextLayer textLayer = image.AddTextLayer("Text 1", new Rectangle(10, 35, image.Width, 35));
ITextPortion firstPortion = textLayer.TextData.Items[0];
firstPortion.Style.FontName = FontSettings.GetAdobeFontName("Comic Sans MS");
var secondPortion = textLayer.TextData.ProducePortion();
secondPortion.Text = "Text 2";
secondPortion.Paragraph.Apply(firstPortion.Paragraph);
secondPortion.Style.Apply(firstPortion.Style);
secondPortion.Style.FontName = FontSettings.GetAdobeFontName("Arial");
textLayer.TextData.AddPortion(secondPortion);
textLayer.TextData.UpdateLayerData();
image.Save(outputFilePng, new PngOptions());
image.Save(outputFilePsd);
}
using (var image = (PsdImage)Image.Load(outputFilePsd))
{
TextLayer textLayer = (TextLayer)image.Layers[2];
string adobeFontName1 = FontSettings.GetAdobeFontName("Comic Sans MS");
string adobeFontName2 = FontSettings.GetAdobeFontName("Arial");
AssertAreEqual(adobeFontName1, textLayer.TextData.Items[0].Style.FontName);
AssertAreEqual(adobeFontName2, textLayer.TextData.Items[1].Style.FontName);
}
PSDNET-917——Aspose.PSD 21.6: ImageSaveException 試圖將 PSD 轉換為 PNG
string srcFile = "input.psd";
string output = "output.png";
using (var image = Aspose.PSD.Image.Load(srcFile))
{
image.Save(output, new Aspose.PSD.ImageOptions.PngOptions());
}
如果你想試用Aspose的全部完整功能,可聯系在線客服獲取30天臨時授權體驗。
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@ke049m.cn