提供3000多款全球软件/控件产品
针对软件研发的各个阶段提供专业培训与技术咨询
根据客户需求提供定制化的软件开发服务
全球知名设计软件,显著提升设计质量
打造以经营为中心,实现生产过程透明化管理
帮助企业合理产能分配,提高资源利用率
快速打造数字化生产线,实现全流程追溯
生产过程精准追溯,满足企业合规要求
以六西格玛为理论基础,实现产品质量全数字化管理
通过大屏电子看板,实现车间透明化管理
对设备进行全生命周期管理,提高设备综合利用率
实现设备数据的实时采集与监控
利用数字化技术提升油气勘探的效率和成功率
钻井计划优化、实时监控和风险评估
提供业务洞察与决策支持实现数据驱动决策
原创|使用教程|编辑:status|2020-04-03 15:05:09.583|阅读 396 次
概述:ImageGear for .NET使用教程
# 慧都年终大促·界面/图表报表/文档/IDE等千款热门软控件火热促销中 >>
ImageGear for .NET是一款图形图像处理控件,具有扫描,压缩,浏览、添加注释,打印,图像编辑,OCR以及PDF和矢量图像支持,使开发人员可以快速地开发出图像处理程序,可用于.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等。
在本教程中,您将为控制台应用程序配置C#或VB.NET项目,并使用ImageGear .NET功能。 您还将学习如何加载图像,然后调整大小并将其转换为新格式。
以下教程专门针对64位安装。 对于32位安装:
使用所需版本的Visual Studio(2010或更高版本):
1、使用C#或VB.NET创建一个新的“控制台应用程序”项目,并将该项目命名为IG_Tutorial_Console。
2、如果使用配置管理器安装了ImageGear .NET 64位,则为x64创建一个新的项目平台(如果尚未安装)。确保将项目设置为针对Debug和x64进行编译。确保您现在拥有$ YOURLOCALPROJ \ bin \ x64 \ Debug \,如果不存在,请创建它。
3、通过以下方式之一将引用和所需资源添加到项目中:
推荐:使用我们的NuGet软件包。对于此项目,您需要以下软件包:Accusoft.ImageGear.Core.nupkg
手动:
将$ INSTALLDIR \ ImageGear .NET v24 64位\ Bin \中的所有文件(和文件夹)复制到项目中的本地输出bin目录(即$ YOURLOCALPROJ \ bin \ x64 \ Debug \)。
将以下引用从$ YOURLOCALPROJ \ bin \ x64 \ Debug \添加到您的项目:
4、至此,您的项目已准备好编写一些代码。以下代码可用于加载图像,将其调整为150 x 150尺寸,并将其转换为用户指定的另一种格式。在下一步中,我们将更详细地介绍此示例代码的某些区域。
C#
using System; using System.IO; using ImageGear.Core; using ImageGear.Evaluation; using ImageGear.Formats; using ImageGear.Processing; using ImageGear.Display; namespace IG_Tutorial_Console { class Program { static void Main(string[] args) { // 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(); Console.WriteLine("Enter the complete path to the image to be converted:"); string fileName = Console.ReadLine(); Console.WriteLine("Enter the format for the new image among BMP|GIF|JPG|PNG|TIFF:"); string newFormat = Console.ReadLine(); try { using (FileStream stream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read)) { try { // Load the image into the page. ImGearPage imGearPage = ImGearFileFormats.LoadPage(stream, 0); // 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)); string outputFileName = fileName.Substring(0,fileName.LastIndexOf('\\') + 1) + "out."; // Indicate the format used when saving the image. // It may be changed for other values, e.g. ImGearSavingFormats.JPG, ImGearSavingFormats.PNG. ImGearSavingFormats savingFormat = ImGearSavingFormats.UNKNOWN; // Identify the format selected. switch (newFormat) { case "BMP": outputFileName += "bmp"; savingFormat = ImGearSavingFormats.BMP_UNCOMP; break; case "GIF": outputFileName += "gif"; savingFormat = ImGearSavingFormats.GIF; break; case "JPG": outputFileName += "jpg"; savingFormat = ImGearSavingFormats.JPG; break; case "PNG": outputFileName += "png"; savingFormat = ImGearSavingFormats.PNG; break; case "TIFF": outputFileName += "tiff"; savingFormat = ImGearSavingFormats.TIF_UNCOMP; break; default: Console.WriteLine("Unsupported format."); break; } if (savingFormat != ImGearSavingFormats.UNKNOWN) { using (FileStream imGearConverted = new FileStream(outputFileName, FileMode.Create)) { // Save the image to the format selected. ImGearFileFormats.SavePage(imGearPage, imGearConverted, 1, ImGearSavingModes.OVERWRITE, savingFormat, new ImGearSaveOptions()); } Console.WriteLine("Conversion successful."); } } catch (ImGearException ex) { Console.WriteLine("Conversion failed: " + ex.Message); } } } catch (Exception) { Console.WriteLine("Incorrect path to an image file."); } Console.ReadLine(); } } }
VB.NET
Imports System Imports System.IO Imports ImageGear.Core Imports ImageGear.Evaluation Imports ImageGear.Formats Imports ImageGear.Processing Imports ImageGear.Display Module Module1 Sub Main() ' 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() Console.WriteLine("Enter the complete path to the image to be converted:") Dim fileName As String = Console.ReadLine() Console.WriteLine("Enter the format for the new image among BMP|GIF|JPG|PNG|TIFF:") Dim newFormat As String = Console.ReadLine() Try Using stream As New FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read) Try ' Load the image into the page. Dim imGearPage As ImGearPage = ImGearFileFormats.LoadPage(stream, 0) ' 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)) Dim outputFileName As String = fileName.Substring(0, fileName.LastIndexOf("\") + 1) + "out." ' Indicate the format used when saving the image. ' It may be changed for other values, e.g. ImGearSavingFormats.JPG, ImGearSavingFormats.PNG. Dim savingFormat As ImGearSavingFormats = ImGearSavingFormats.UNKNOWN ' Identify the format selected. S elect Case newFormat Case "BMP" outputFileName += "bmp" savingFormat = ImGearSavingFormats.BMP_UNCOMP Case "GIF" outputFileName += "gif" savingFormat = ImGearSavingFormats.GIF Case "JPG" outputFileName += "jpg" savingFormat = ImGearSavingFormats.JPG Case "PNG" outputFileName += "png" savingFormat = ImGearSavingFormats.PNG Case "TIFF" outputFileName += "tiff" savingFormat = ImGearSavingFormats.TIF_UNCOMP End S elect If Not savingFormat = ImGearSavingFormats.UNKNOWN Then Using imGearConverted As FileStream = New FileStream(outputFileName, FileMode.Create) ' Save the image to the format selected. ImGearFileFormats.SavePage(imGearPage, imGearConverted, 1, ImGearSavingModes.OVERWRITE, savingFormat, New ImGearSaveOptions()) Console.WriteLine("Conversion successful.") End Using Else Console.WriteLine("Unsupported format.") End If Catch ex As Exception Console.WriteLine("Conversion failed: " + ex.Message) End Try End Using Catch ex As Exception Console.WriteLine("Incorrect path to an image file.") End Try Console.ReadLine() End Sub End Module
本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@pclwef.cn
本文探讨 SQL Server 中 NULL 和空值之间的区别,并讨论如何有效地处理它们。
Unity 是一款功能极其丰富的游戏引擎,允许开发人员将各种媒体集成到他们的项目中。但是,它缺少最令人兴奋的功能之一 - 将 Web 内容(例如 HTML、CSS 和 JavaScript)直接渲染到 3D 场景中的纹理上的能力。在本文中,我们将介绍如何使用 DotNetBrowser 在 Unity3D 中将 Web 内容渲染为纹理。
DevExpress v24.2帮助文档正式发布上线了,请按版本按需下载~
本教程将向您展示如何用MyEclipse构建一个Web项目,欢迎下载最新版IDE体验!
使您可以在应用程序中添加扫描和压缩,OCR和条形码识别,PDF和矢量图支持,文件查看、处理和打印,图形编辑和处理等功能。
服务电话
重庆/ 023-68661681
华东/ 13452821722
华南/ 18100878085
华北/ 17347785263
客户支持
技术支持咨询服务
服务热线:400-700-1020
邮箱:sales@pclwef.cn
关注我们
地址 : 重庆市九龙坡区火炬大道69号6幢