Merge two images into one

Nov 26, 2013 at 1:52 PM
I want to merge two images into one. I read that I should use WriteableBitmapEx library and use blit method. Both of my images are Image type.

So, should I first convert Image type to WriteableBitmap ?
Like this:

    var im1 = image1.ToImage().ToBitmap(); 
    var im2 = image2.ToImage().ToBitmap();
And how can I use method blit now ?
Nov 26, 2013 at 7:26 PM
I have been trying to use Blit method like this
BitmapImage image1 = new BitmapImage();
            BitmapImage image2 = new BitmapImage();

            image1 = new BitmapImage(new Uri("/Images/pic1.jpg"));
            image2 = new BitmapImage(new Uri("/Images/pic2.jpg"));

            WriteableBitmap merge1 = new WriteableBitmap(image1);
            WriteableBitmap merge2 = new WriteableBitmap(image2);

            var photo = merge1;
            var frame = merge2;

            var merge = new WriteableBitmap(2048, 1536);

            merge.Blit(new Rect(0, 0, 2048, 1536), photo, new Rect(0, 0, photo.PixelWidth, photo.PixelHeight)); 
            merge.Blit(new Rect(0, 0, 2048, 1536), frame, new Rect(0, 0, frame.PixelWidth, frame.PixelHeight)); 
but im getting error:

Error 5 'System.Windows.Media.Imaging.WriteableBitmap' does not contain a definition for 'Blit' and no extension method 'Blit' accepting a first argument of type 'System.Windows.Media.Imaging.WriteableBitmap' could be found (are you missing a using directive or an assembly reference?)
Nov 27, 2013 at 1:46 PM
Well, you have to use this extension library in the right way. Please see the source code samples. There are a few that show how it should be used. Even the project's start site has a sample.