Transformando un System.Drawing.Image a un Gdk.Pixbuf

24 abril 2007

La receta es sencilla, y no conozco una forma más elegante de hacerlo. Si alguien tiene algún comentario, adelante.

CSharp:
  1. static Gdk.Pixbuf Image2Pixbuf( Image image ) {
  2.   using ( MemoryStream stream = new MemoryStream() )
  3.   {
  4.     image.Save( stream, System.Drawing.Imaging.ImageFormat.Png );
  5.     stream.Position = 0;
  6.     return new Gdk.Pixbuf( stream );
  7.   }
  8. }

Si, me he puesto un poco técnico, pero no quería dejar el blog más tiempo sin actualizar.

Mono/.Net, Programación, Tecnología | Comentarios | Trackback Saltar al inicio de la página

Un comentario de “Transformando un System.Drawing.Image a un Gdk.Pixbuf”

  1. 01

    [...] first comes from this site (its in Spanish), this snippet allows you to take a System.Drawing.Image to a Gdk.Pixbuf and it [...]

    Nifty Gtk Snippets. | Free Lancers Unite el 24 noviembre 2010 sobre las 15:34
    Saltar al inicio de la página

Al habla

  •  
  •  
  •  

Puedes estar al tanto de nuevos comentarios con el feed de los comentarios.

Al fin y al cabo todo es cuestión de unos y ceros…




Archivos

Meta