and the box where I need to put that image is sized 400x300:
So I resize the image to 0, 300 so the height matches the box height (which is not correct):
Then I try to add the second image on top of that one (again, did not come out correct):
But what I am wanting to do is fill in the exposed background area(s) that are just a plan color (which is white in this example) with the original image with it blurred like so:
What would be the code below need modified in order to do that using the Magick.net C#?
My code:
Code: Select all
stream = getPic.OpenRead(new Uri(@"C:\Users\David\Pictures\YnTf9.png"));
Bitmap bitmap1 = new Bitmap(stream);
stream = getPic.OpenRead(new Uri(@"C:\Users\David\Pictures\YnTf9.png"));
Bitmap bitmap2 = new Bitmap(stream);
using (MagickImageCollection images = new MagickImageCollection())
{
// Add the first image
MagickImage first = new MagickImage(bitmap1);
first.Crop(400, 300);
first.Blur(0, 10);
images.Add(first);
// Add the second image
MagickImage second = new MagickImage(bitmap2);
second.Crop(0, 300, Gravity.Center);
images.Add(second);
// Create a mosaic from both images
using (IMagickImage result = images.Mosaic())
{
// Save the result
result.Resize(400, 300);
result.Write(@"C:\Users\David\Pictures\TEST.png");
}
}