How to C#: Imaging
Using Imaging SDK for C#.NET
Winforms Controls
Image Load
Image Access and Modify
Quick to Start
  |  
Home ›› XImage.Raster ›› C# Raster: Quick to Start

How to C#: Quick to Start Using XImage.Raster


To Have a Quick Evaluation of XImage.Raster in Visual C# Console Application




As a leading professional third-party SDK supplier in the field of image and document management, RasterEdge has always been devoted to providing various effective and fully-functional imaging solutions for developers who are working on different .NET developing applications.


Related .net document control helps:
asp.net text file viewer: C# HTML5 Viewer: Load, View, Convert, Annotate and Edit OpenOffice, CSV and Text file
view file asp.net: View multiple document formats in ASP.NET, MVC, Ajax, Azure using C# control
asp.net annotate pdf control: ASP.NET Annotate PDF Control: annotate, comment, markup PDF document online using ASP.NET C#
asp.net dotnetnuke pdf editor control: ASP.NET DNN PDF Editor Control: view, edit PDF files in Dotnetnuke application
asp.net convert pdf control: ASP.NET Convert PDF Control: Convert, export PDF to Word, HTML, Tiff files in C# ASP.NET
asp.net pdf file permission control: ASP.NET PDF File Permission Control: apply, remove PDF file permission settings in C#
asp.net edit pdf page control: ASP.NET PDF Pages Edit Control: add, remove, sort, replace PDF pages online using C#


This C#.NET image processing toolkit, RasterEdge XImage.Raster SDK for .NET is one of the most strongly-featured and mature document imaging library toolkits on the market, which is designed to help developers implement Image-related tasks in their C#.NET applications.


Using this C#.NET image document processor control, you can easily and quickly complete image creating and loading, conversion, image annotation and more in any type of a 32-bit or 64-bit .NET application, including ASP.NET web service and Windows Forms for any .NET Framework version from 2.0 to 4.5.


As you know, there're various reliable image processing features that can be implemented in C#.NET programming. And you may want to have a quick testing on RasterEdge XImage.Raster after downloading its free trial package online.  To meet your requirement, on this quick to start page, we will tell how to create a C# console application, and C# WinForms application load , and save a new image file.




Create a C# Console Application



Open Visual Studio and click "New" from toolbar. Note, Visual Studio 2005 and above versions are available ;


Choose "C# Language" and "Console Application" respectively to create a project.




Sample C# Code for Convert Bmp Format to Png Format and Save



By following steps below, your C# project will convert input bmp image file to png file according to priority, and then create a new png file to a defined output path.


Add necessary XImage.Raster DLL libraries into your created C# application as references.


  RasterEdge.Imaging.Basic.dll


  RasterEdge.XImage.Raster.dll


  RasterEdge.XImage.Raster.Core.dll


Use namespace "RasterEdge.Imaging.Basic";


Use namespace "RasterEdge.XImage.Raster";


Note: When you get the error "Could not load file or assembly 'RasterEdge.Imaging.Basic' or any other assembly or one of its dependencies. An attempt to load a program with an incorrect format", please check your configure as follows:

       

       If you are using x64 libraries/dlls, Right click the project -> Properties -> Build -> Platform target: x64.

       

       If using x86, the platform target should be x86.


Copy of the following C# sample code to your application.




String inputFilePath = Program.RootPath + "\\"  +  "input.bmp";
String outputFilePath = Program.RootPath + "\\"  +  "output.png";
RasterImage img = new RasterImage(inputFilePath);
//Convert format and save.
img.Save(outputFilePath);






Sample C# Code for Create WinFroms Application Fast


By following steps below, your C# WinForms project view image.


Open or create a new WinForms application, add “RasterEdge.XImage.Raster.WinFormsControl.dll”to the project’s reference.


Add a new Form Item to the project, and choose to design mode sign. Make the ToolBox view show.


Right click the ToolBox panel, and select “Choose Items…”, in the .NET Framework Components tab of pop-up dialog, click “Browse…”button to navigate the “RasterEdge.XImage.Raster.WinFormsControl.dll”, and make sure the “ImageView”and “ThumbnailView”is checked.


Now the RasterEdge image view control appears in the ToolBox. Just drag and drop the “ImageView”and “ThumbnailView”items to your new Form control.


To make the ThumbnailView connect to the ImageView, add the following code to the Form Initialize method.




public Form1()
{
     InitializeComponent();
     WorkRegistry.Reset();
     this.thumbnailView1.ThumbImageIndexChanged += new RasterEdge.XImage.Raster.WinFormsControl.ThumbImageIndexChangedEventHandler(thumbnailView1_ThumbImageIndexChanged);
     this.thumbnailView1.OpenImage("sample.jpeg");
}
void  thumbnailView1_ThumbImageIndexChanged(object sender,  RasterEdge.XImage.Raster.WinFormsControl.ThumbImageIndexChangedEventArgs e)
 {
     ThumbnailItem item = e.ThumbItem;
     this.imageView1.ShowImage(item, false);
 }