public static string EncodeUserPhoto(Gdk.Pixbuf image, int size) { try { //Logger.Debug("Resizing photo"); image = image.ScaleSimple(size, size, Gdk.InterpType.Bilinear); string encodedUserPhoto = System.Convert.ToBase64String(image.SaveToBuffer("jpeg")); Logger.Debug("encodedPhotoString: " + encodedUserPhoto); return encodedUserPhoto; } catch (GLib.GException) {} Logger.Debug ("Unable to load icon user photo."); return null; }