Hey!
Give this a shot:
using System;
using System.IO;
using System.Drawing;
using System.Drawing.Imaging;
public class ImageTest
{
public static void Main()
{
Gtk.Application.Init();
Bitmap bitmap = new Bitmap("Cheese.jpg");
Gtk.Window window = new Gtk.Window("ImageTest");
Gtk.Image image = new Gtk.Image(ImageToPixbuf(bitmap));
window.Add(image);
window.ShowAll();
Gtk.Application.Run();
}
private static Gdk.Pixbuf ImageToPixbuf(Image image)
{
using (MemoryStream stream = new MemoryStream()) {
image.Save(stream, ImageFormat.Bmp);
stream.Position = 0;
Gdk.Pixbuf pixbuf = new Gdk.Pixbuf(stream);
return pixbuf;
}
}
}
Regards,
Eric
Phil Durand wrote:
> I'm using a third party library which uses System.Drawing.Image and
> whatnot to deal with pictures. I need to convert those images into
> Gdk.Pixbufs to be displayed using GTK#, and vice versa. Is there anyone
> who could point me in the right direction? Someone said something about
> gtk.dotnet but I dont see anything in there that would help me so far.
>
> Any help would be appreciated,
>
> Philippe Durand
> Galaxium Messenger
> http://galaxium.sourceforge.net/
>
_______________________________________________
Gtk-sharp-list maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list