翻譯|使用教程|編輯:莫成敏|2020-04-03 15:20:13.110|閱讀 217 次
概述:在本教程中,您將為控制臺應(yīng)用程序配置C#或VB.NET項目,并使用ImageGear .NET功能。 您還將學(xué)習(xí)如何加載圖像,然后調(diào)整大小并將其轉(zhuǎn)換為新格式。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
ImageGear for .NET是一款圖形圖像處理控件,具有掃描,壓縮,瀏覽、添加注釋,打印,圖像編輯,OCR以及PDF和矢量圖像支持,使開發(fā)人員可以快速地開發(fā)出圖像處理程序,可用于.NET Framework2.0、3.0、3.5、4.0,ASP.NET,WPF,SilverLight,DirectX 10和Direct3D 10。支持超過100種圖片格式,包含:TIFF, JPEG, CAD, Vector, 3D PDF, PDF/A, PS等。
在本教程中,您將為控制臺應(yīng)用程序配置C#或VB.NET項目,并使用ImageGear .NET功能。 您還將學(xué)習(xí)如何加載圖像,然后調(diào)整大小并將其轉(zhuǎn)換為新格式。本教程內(nèi)容較多,分為上下兩篇內(nèi)容,本文為后半部分內(nèi)容,緊接上文!
5、如果使用的是部署(運(yùn)行時)許可,請?zhí)砑釉S可初始化代碼。 如果您正在使用評估或開發(fā)(工具包)許可證,則沒有必要。 如果您正在評估產(chǎn)品,請?zhí)砑覫mGearEvaluationManager.Initialize()調(diào)用。
C#
// Initialize license for a Deployment(Runtime) license. //***The SetSolutionName, SetSolutionKey and possibly the SetOEMLicenseKey //methods must be called to distribute the runtime.*** //ImGearLicense.SetSolutionName("YourSolutionName"); //ImGearLicense.SetSolutionKey(12345, 12345, 12345, 12345); //Manually Reported Runtime licenses also require the following method //call to SetOEMLicenseKey. //ImGearLicense.SetOEMLicenseKey("2.0.AStringForOEMLicensing..."); // Initialize evaluation license. ImGearEvaluationManager.Initialize(); // Initialize common formats. ImGearCommonFormats.Initialize();
VB.NET
' Initialize license for a Deployment(Runtime) license. '***The SetSolutionName, SetSolutionKey and possibly the SetOEMLicenseKey 'methods must be called to distribute the runtime.*** 'ImGearLicense.SetSolutionName("YourSolutionName"); 'ImGearLicense.SetSolutionKey(12345, 12345, 12345, 12345); 'Manually Reported Runtime licenses also require the following method 'call to SetOEMLicenseKey. 'ImGearLicense.SetOEMLicenseKey("2.0.AStringForOEMLicensing..."); 'Initialize evaluation license. ImGearEvaluationManager.Initialize() 'Initialize common formats. ImGearCommonFormats.Initialize()
6、我們使用以下方法加載圖像:
C#
// Load the image into the page. ImGearPage imGearPage = ImGearFileFormats.LoadPage(stream, 0);
VB.NET
' Load the image into the page. Dim imGearPage As ImGearPage = ImGearFileFormats.LoadPage(stream, 0)
7、我們通過定義寬度,高度和插值方法來調(diào)整圖像的大小,如下所示:
C#
// Resize the image to the width and height specified. // ImGearInterpolations.BILINEAR is the value indicating the type of interpolation employed. // It may be changed for other values, e.g. ImGearInterpolations.BICUBIC, ImGearInterpolations.NEAREST_NEIGHBOR. ImGearProcessing.Resize(imGearPage, 150, 150, ImGearInterpolationOptions.GetDefault(ImGearInterpolations.BILINEAR));
VB.NET
' Resize the image to the width and height specified. ' ImGearInterpolations.BILINEAR is the value indicating the type of interpolation employed. ' It may be changed for other values, e.g. ImGearInterpolations.BICUBIC, ImGearInterpolations.NEAREST_NEIGHBOR. ImGearProcessing.Resize(imGearPage, 150, 150, ImGearInterpolationOptions.GetDefault(ImGearInterpolations.BILINEAR))
8、最后,我們根據(jù)指定的saveFormat保存圖像:
C#
// Save the image to the format selected. ImGearFileFormats.SavePage(imGearPage, imGearConverted, 1, ImGearSavingModes.OVERWRITE, savingFormat, new ImGearSaveOptions());
VB.NET
' Save the image to the format selected. ImGearFileFormats.SavePage(imGearPage, imGearConverted, 1, ImGearSavingModes.OVERWRITE, savingFormat, New ImGearSaveOptions())
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉(zhuǎn)載自: