Guide for C#
Open Image from File
Core Document Formats
Additional Features

C# Imaging - Load Image from File in C#.NET

Free Visual C# Codes for Loading Image from Local File with .NET Imaging SDK

Visual C#
Home > .NET Imaging SDK > C# > Load Image from File
If this is your first time to use our DocImageSDK, we strongly suggest you reading How to Start first!

RasterEdge .NET Imaging SDK contains several library DLLs to fulfill multiple image processing & manipulation tasks. Among all the controls, there is a RasterEdge.Imaging.Basic.dll which is designed for C# and VB.NET developers to perform some basic imaging functions such as loading image from a file, loading file from .NET graphics, creating a new image, and printing or saving an image to your local disk, and so on. As for loading image from a file using RasterEdge.Imaging.Basic.dll in C# project, please see details as below.
  • Loading an image from local file by specifying path
  • Supporting loading images in png, gif, jpeg, tiff and bmp image formats
  • Only two lines of C# coding needed for opening an image locally
  • Open and display an image with Visual C# samples codes
  • Easy to integrate into Microsoft Visual Studio 2005 and above versions
  • Compatible with .NET Framework 2.0 or later
This Visual C# tutorial for loading an image from local file includes the following parts:
  • C# project and library preparation
  • C# methods for image loading
  • C# sample codes to load image from file
  • Some more related C# imaging tutorials
If you are a Visual Basic programmer, please go to Load Image from Files in VB.NET. If you are looking for tutorial on how to view Image and document in WinForms or ASP.NET Web application, please go to tutorials for loading Image from files in Windows Forms and Web Document Image.)
C# Project and Library Preparation
  • At the very beginning, please download the trial package or the licensed software to your computer and unzip it.
  • Start up your MS Visual Studio and create a new Visual C# project such as Windows Application.
  • Now please open your unzipped RasterEdge.DocImageSDK and double click on the RasterEdge.Imaging License Manager.exe to get an evaluation license.
  • Now please copy the generated evaluation license RasterEdgeLicense.txt and the library RasterEdge.Imaging.Drawing.dll to your imaging project.
  • Add the library component to your project reference. Simply right click on Solution Explorer, choose Add Reference..., and then browse to locate your library.
  • You can now call the following RasterEdge DocImageSDK namespace in your program.
using RasterEdge.Imaging.Basic.Core;
using RasterEdge.Imaging.Basic;
using RasterEdge.Imaging.Basic.Codec;
Image Loading C# Methods
RasterEdge provides OpenImageFile methods for developers to load an image using Visual C# programming language. Please replace corresponding information, such as filepath, according to your imaging program scenario.
Please note that the commonly used image formats are all supported by this imaging library, such as png, gif, jpeg, tiff and bmp. This loading functionality is the basis for many imaging features such as image resizing, scaling, cropping, rotating, flipping, and converting, to name just a few.
public static REImage OpenImageFile(string filePath);
public static REImage OpenImageFile(string filePath, BaseDecoder dec);
How to Load Image from File with C# Sample Codes
After the introduction for the setup, namespace and methods, here we provide the visual C# sample codes to load an image from your local file / disk by using this RasterEdge .NET Imaging SDK . Now please copy the C# demo coding to your program to open an image from your file. Make sure you have made necessary adjustments according to your file directory where the image is stored.
When the image is loaded, users can conduct a variety of image processing and manipulation actions. You can resize the loaded image with C# coding, rotate it within 360 degrees, add a barcode in the image, or decode the barcode in it, duplicate / flip the image, and convert the images to other image formats such as png, jpeg, gif, tiff and bmp.
using RasterEdge.Imaging.Basic.Core;
using RasterEdge.Imaging.Basic.Codec;
using RasterEdge.Imaging.Basic;

namespace RE__Test
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
string fileName = "c:/Sample.png";

REImage reImage = REFile.OpenImageFile(fileName);

REFile.SaveImageFile(reImage, "c:/reimage.png", new PNGEncoder());
}
}
}
More Imaging Viewing Guide!


Recommend this to Google+