Just use the debugger to verify:
image1 != null
image1.Source != null
image1.Source is BitmapImage
or add
System.Diagnostics.Debug.Assert(image1 != null, "image1 is null");
System.Diagnostics.Debug.Assert(image1.Source != null,
"image1.Source is null");
System.Diagnostics.Debug.Assert(image1.Source is BitmapImage,
"image1.Source is NOT a BitmapImage");
right before the call to BufferFromImage.
Then you should know what is wrong and how to fix it.