tags:

views:

109

answers:

4

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?

A: 

GDI+ comes installed with .NET

jojaba
+1  A: 

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;
Mark Cidade
Could you explain using the Drawing/Graphics already in .NET to create layers which can be switched to allow movement of images based on the layer?
Rekar
I added some info about animated GIFs.
Mark Cidade
Hmm, Not exactly what I meant. I didnt mean Animated images when I referred to movement. I was actually meaning the position of the image allowing to be moved separated by layers, much like paint.net, but a much more simple form.
Rekar
I updated my answer again.
Mark Cidade
Im a total newb. Can you explain this piece of code a bit, or how to properly implement the code you provided?
Rekar
I added an explanation.
Mark Cidade
A: 

I've used the third-party tool called LeadTools Imaging Pro SDK with great success.

http://www.leadtools.com/sdk/image-processing/default.htm

Usually anything like Paint.Net functionality will be obtained by way of third-party software or a lot of coding on your part.

BobaFett
Im just looking for some basic functionality. Much like any diagramming software, like Visio for instance. I dont need photoshop like features, just some basics to add some things to a picturebox, and be able to move around the individual pieces when needed.
Rekar
A: 

Leadtools and Atalasoft DotImage are both pretty good. I've had good luck with Leadtools. You can use the builtin system.drawing features with Leadtools and probably DotImage.

xpda
Also, FreeImage is a free open source option.
xpda