翻譯|使用教程|編輯:李顯亮|2020-07-03 10:22:21.833|閱讀 325 次
概述:Adobe Illustrator文件主要用于表示視覺信息。有時需要將AI轉換為光柵圖像(PNG,JPG等)或PDF文件。Aspose.PSD for .NET API能夠轉換AI文件,而無需依賴任何第三方應用程序。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
Adobe Illustrator文件主要用于表示視覺信息。有時需要將AI轉換為光柵圖像(PNG,JPG等)或PDF文件。所有這些轉換中最重要和令人興奮的因素是,不需要安裝或配置Adobe Illustrator應用程序,因為Aspose.PSD for .NET API能夠轉換AI文件,而無需依賴任何第三方應用程序。
用于.NET API的Aspose.PSD提供了許多與PSD,PSB,AI和許多其他文件格式一起使用的功能。讓我們探討以下將AI轉換為其他圖片格式的用例:
Aspose.PSD for .NET已升級至V20.5,如果你還沒有用過Aspose.PSD可以點擊這里下載最新版測試。
重要的是在此處注意,我們將考慮將兩個不同的AI文件作為以下幾個示例的輸入。輸入的AI文件之一具有不同的路徑權重,另一個AI文件包含復雜的輪廓。因此,讓我們查看將要使用的AI文件的屏幕截圖:
具有不同路徑權重的AI文件
包含復雜輪廓的AI文件
PNG圖像非常出名,通常是在線提交圖像的標準。因此,可以按照以下步驟將AI轉換為PNG文件:
以下代碼段基于上述步驟,顯示了如何使用C#將AI轉換為PNG:
string[] sourcesFiles = new string[] { @"34992OStroke", @"rect2_color", }; for (int i = 0; i < sourcesFiles.Length; i++) { string name = sourcesFiles[i]; string sourceFileName = dataDir + name + ".ai"; string outFileName = dataDir + name + ".png"; using (AiImage image = (AiImage)Image.Load(sourceFileName)) { ImageOptionsBase options = new PngOptions() { ColorType = PngColorType.TruecolorWithAlpha }; image.Save(outFileName, options); } }
將AI文件轉換為JPG圖像非常簡單。需要按照以下步驟操作:
以下代碼段顯示了如何在C#應用程序中將AI轉換為JPG:
string[] sourcesFiles = new string[] { @"34992OStroke", @"rect2_color", }; for (int i = 0; i < sourcesFiles.Length; i++) { string name = sourcesFiles[i]; string sourceFileName = dataDir + name + ".ai"; string outFileName = dataDir + name + ".jpg"; using (AiImage image = (AiImage)Image.Load(sourceFileName)) { ImageOptionsBase options = new JpegOptions() { Quality = 85 }; image.Save(outFileName, options); } }
PSD文件是包含分層圖像的photoshop文檔。可以不使用Adobe Photoshop或Adobe Illustrator將AI轉換為PSD。請按照以下步驟執行轉換:
下面的代碼段顯示了如何在C#.NET應用程序中將AI轉換為PSD:
string[] sourcesFiles = new string[] { @"34992OStroke", @"rect2_color", }; for (int i = 0; i < sourcesFiles.Length; i++) { string name = sourcesFiles[i]; string sourceFileName = dataDir + name + ".ai"; string outFileName = dataDir + name + ".psd"; using (AiImage image = (AiImage)Image.Load(sourceFileName)) { ImageOptionsBase options = new PsdOptions(); image.Save(outFileName, options); } }
PDF文件格式之所以出名,是因為幾乎所有平臺都支持.pdf文件擴展名。此外,除非文檔作者允許,否則PDF文件易于更改和修改。有時,可能需要與合作伙伴或客戶共享內容,而不允許他們進行任何修改。因此,在這種情況下,將AI轉換為PDF很有幫助。您需要按照以下步驟執行轉換:
以下代碼段顯示了如何使用C#將AI轉換為PDF:
string[] sourcesFiles = new string[] { @"rect2_color", }; for (int i = 0; i < sourcesFiles.Length; i++) { string name = sourcesFiles[i]; string sourceFileName = dataDir + name + ".ai"; string outFileName = dataDir + name + ".pdf"; using (AiImage image = (AiImage)Image.Load(sourceFileName)) { ImageOptionsBase options = new PdfOptions(); image.Save(outFileName, options); } }
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn