Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET Image Libraries

Tags:

c#

image

What are some good image libraries for C#? Mainly for things such as painting in layers. Or maybe a resource that can describe similar tasks?

like image 959
Rekar Avatar asked Sep 04 '10 19:09

Rekar


People also ask

Is C# good for image processing?

C# is actually a great language to use for image processing because it's so powerful. With these image processors, you can change and manipulate colors, image orientations, add the filter and blend effects, change image size, and much more.

What is ImageSharp?

ImageSharp is a new, fully featured, fully managed, cross-platform, 2D graphics library. Designed to simplify image processing, ImageSharp brings you an incredibly powerful yet beautifully simple API. ImageSharp is designed from the ground up to be flexible and extensible.

What is image processing in C#?

ImageProcessor is a collection of lightweight libraries written in C# that allows you to manipulate images on-the-fly using .NET 4.5+ It consists of two main libraries ImageProcessor - For desktop and application use and ImageProcessor. Web - a dynamic image processing extension built for ASP.NET.

What is .NET core library?

NET Core are open-source including class libraries, runtime, compilers, languages as well as application frameworks. . NET Core also supports C#, Visual Basic, and F#. It can run the application code with the same behavior on multiple architectures, including x64, x86, and ARM.


2 Answers

With System.Drawing:

Image GetLayeredImage(int width, int height, params Image[] layers)
 {  Point layerPosition = new Point(0,0);
    Bitmap bm = new Bitmap(width,height);
    using(Graphics g = Graphics.FromImage(bm))
     { foreach(Image layer in layers) g.DrawImage(layer, layerPosition);
     }
    return bm;
 }

In the above example, a method, GetLayeredImage() is defined that accepts the width/height of the composite image, along with an array of Image objects, one for each layer. A point at (0,0) is defined as the top-left position for each layer. A Bitmap object is created and from that a Graphics object is created for drawing onto the bitmap. Each image in the array is then drawn onto the bitmap at the point (0,0)—you may want to change this by creating a different Point value for each layer. The resulting bitmap is then returned. The return value is an image with all the layers drawn.

Here's an example on how to call this method:

Image layer1 = Image.FromFile("layer1.jpg");
Image layer2 = Image.FromFile("layer2.jpg");
Image layeredImg = GetLayeredImage(width,height,layer1,layer2);
pictureBox.Image = layeredImg;
like image 112
Mark Cidade Avatar answered Oct 05 '22 23:10

Mark Cidade


GDI+ comes installed with .NET

like image 32
tidwall Avatar answered Oct 06 '22 01:10

tidwall