ImageDev C#
This section details how to start with ImageDev .NET.
The following information has been mostly tested on Windows with Visual 2017 on .NET Framework and .NET
Core projects.
ImageDev C# can be installed with the NuGet package archives available in the ImageDev download page.
To launch ImageDev examples or to create a new ImageDev .NET project, you need to:
On Windows, when using Visual Studio, they can be created from the option menu. In other cases, they can be created by command line or with a configuration file.
This section explains how to create two package sources:
A solution containing these examples is provided in the ImageDevExamplesNet package archive. This solution is already linked to the IOFormat library and ImageDev sample data. It is not necessary to add the NuGet ImageDev Examples archive package source to use it.
On Windows, when using Visual Studio, they can be installed from the package manager tool. In other cases, they can be added by command line.
ImageDev C# can be installed with the NuGet package archives available in the ImageDev download page.
Prerequisites
Supported platforms
ImageDev requires a .NET platform compatible with .NET Standard 2.0 or 2.1, which means:- On Windows:
- .NET Framework 4.6.1 with Visual Studio 2017 or 2019
- .NET Core 2.1 or 2.2 with Visual Studio 2017
- .NET Core 2.1, 2.2, 3.X, or .NET 5 with Visual Studio 2019
- .NET Core 2.1, 2.2, 3.X, .NET 5, or 6 with Visual Studio 2022
- On Linux (Ubuntu 18.04):
- .NET Core 2.1, 2.2, 3.X, .NET 5, or 6
Package deployment
ImageDev C# is distributed as NuGet packages available in downloadable archives.To launch ImageDev examples or to create a new ImageDev .NET project, you need to:
- Download the ImageDevNet and ImageDevExamplesNet package archives corresponding to your OS and compiler.
- Unzip these archives in a folder.
- path_to_unzipped_ImageDev is the path to the unzipped ImageDevNet folder
- path_to_unzipped_ImageDevExamples is the path to the unzipped ImageDevExamplesNet folder
NuGet package manager setup
To make ImageDev packages available for a .NET project, the appropriate package sources must be added.On Windows, when using Visual Studio, they can be created from the option menu. In other cases, they can be created by command line or with a configuration file.
This section explains how to create two package sources:
- NuGet ImageDev archive that is necessary to use the ImageDev and IOLink libraries.
- NuGet ImageDev Examples archive that is only necessary to use the IOFormat library or to access the ImageDev sample data out of the UserGuide.sln solution. This source is optional.
- In Visual Studio, open the Tools > Options > NuGet Package Manager > General panel.
- Set the Default package management format menu to PackageReference.
With Visual Studio
To add the new package source for all projects with Visual Studio:- Run Visual Studio.
- Go in the "Tools menu" and select "Options..."
- Unfold "NuGet Package Manager".
- Select "Package Sources".
- Press the "+" green button; a new line is added.
- Enter "NuGet ImageDev archive" in the "Name" field.
- Enter the path_to_unzipped_ImageDev/nuget value in the "Source" field.
- Press the "Update" button.
- Press the "+" green button; a new line is added.
- Enter "NuGet ImageDev Examples archive" in the "Name" field.
- Enter the path_to_unzipped_ImageDevExamples/nuget value in the "Source" field.
- Press the "Update" button.
- Press the "OK" button.
With command line instructions
To add the new package source for all projects, execute the following command lines:dotnet nuget add source "path_to_unzipped_ImageDev/nuget" --name "NuGet ImageDev archive" dotnet nuget add source "path_to_unzipped_ImageDevExamples/nuget" --name "NuGet ImageDev Examples archive"More information about the used command line is available on the Microsoft site.
With a configuration file
To add the new package source for only one project, you need to create a nuget.config file next to your project. This file should contain the following lines:<?xml version="1.0" encoding="utf-8"?> <configuration> <packageSources> <add key="NuGet ImageDev archive" value="path_to_unzipped_ImageDev/nuget" /> <add key="NuGet ImageDev Examples archive" value="path_to_unzipped_ImageDevExamples/nuget" /> </packageSources> </configuration>More information about the nuget.config file is available on the Microsoft site.
Launching the ImageDev examples
This section describes how to launch the examples of the ImageDev user guide tutorials.A solution containing these examples is provided in the ImageDevExamplesNet package archive. This solution is already linked to the IOFormat library and ImageDev sample data. It is not necessary to add the NuGet ImageDev Examples archive package source to use it.
- Open the path_to_unzipped_ImageDevExamples/examples/project/UserGuide.sln solution.
- Build the "UserGuide" solution.
- Set the "T01_01_HelloImageDev" project as Startup Project.
- Start the project execution.
- Compare the resulting images, generated in the path_to_unzipped_ImageDevExamples/examples/bin/arch-X folder, with those shown in the HelloImageDev tutorial.
- Run the other examples of the HelloImageDev user guide
Configuring a .NET project
To use ImageDev, you first need to open or create a .NET project and install the required packages.On Windows, when using Visual Studio, they can be installed from the package manager tool. In other cases, they can be added by command line.
With Visual Studio
For a Visual Studio project, the ImageDev prepacks are managed by NuGet.- In the solution explorer, right click on the project to be linked with ImageDev.
- Select the "Manage NuGet packages..." item.
- In the "Package source" list, select the "NuGet ImageDev archive" source.
- In the "Browse" tab, search ImageDev.
- Select "ImageDev-win-x64" and press install.
- To use IOFormat, for loading and saving image files, install also the "IOFormat" NuGet package.
- In the "Package source" list, select the "NuGet ImageDev Examples archive" source.
- In the "Browse" tab, search IOFormat.
- Select "IOFormat" and press install.
- To access ImageDev sample data, install also the "ImageDev.Data" NuGet package.
- A .NET framework project must explicitely be set to 64-bit target platform.
- In the "Project" menu, select "Properties...".
- Select the "Build" panel.
- In the "General" section, uncheck the "Prefer 32-bit" box.
With command line instructions
To add the new package for your project, execute the following command lines from your project folder:# Installation of ImageDev Windows package dotnet add package ImageDev-win-x64 # or installation of ImageDev Ubuntu package # dotnet add package ImageDev-ubuntu-x64 # To use IOFormat, for loading and saving image files, install also "IOFormat" NuGet package dotnet add package IOFormat # To access ImageDev sample data, install also "ImageDev.Data" NuGet package dotnet add package ImageDev.DataMore information about the used command line is available on the Microsoft site.
Start using ImageDev
You need to add the using directives for ImageDev, and optionally for IOLink and IOFormat.using ImageDev; using IOLink; using IOFormat;You are now ready to write your first ImageDev code.