_From @Schaussi on September 7, 2016 8:11_
Unfortunately, I have not found a way to do this yet.
Does a method like Graphics.DrawImage() exist in ImageProcessorCore?
E.g. it would be great if something like this would work:
using (Graphics g = Graphics.FromImage(_resultImage))
{
g.DrawImage(_otherImage, x, y);
}
Thank you
_Copied from original issue: JimBobSquarePants/ImageProcessor#470_
_From @dlemstra on September 7, 2016 8:59_
@JimBobSquarePants We call this Compose in ImageMagick. Maybe we should add a Compose Sampler? I can add this.
There's no 2D drawing in ImageProcessor yet.....
I have an open ticket #264 that would cover paths etc but that still has work to do. Whatever we make I want it to be feature rich, easy to use and powerful. The architecture would be difference from the standard samplers.
_From @dlemstra on September 7, 2016 9:30_
This is not drawing text/paths. Its drawing one image on top of another image. In other words copy pixels from the source image to the destination image. I would prefer to do this in a Compose sampler so we could add features like only copying one channel.
@dlemstra I'd actually like to have a look at splitting channels. The blend processor can merge based on lerping but that's all or nothing.
_From @Emyr42 on September 13, 2016 17:11_
using (Graphics g = Graphics.FromImage(_resultImage)) { g.DrawImage(_otherImage, x, y); }
Create an ImageFactory using a Stream (wherever you got _otherImage, or save _otherImage to a MemoryStream)...
_otherImageFactory.Overlay(
new ImageLayer
{
Image = _resultImage,
Position = new System.Drawing.Point(x, y)
}
);
Maybe Overlay needs more parameters?
THATS NOT CORE
_From @Emyr42 on September 13, 2016 21:34_
No need to shout. Other projects make it a little more obvious by having distinct repositories.
_From @Emyr42 on September 13, 2016 22:32_
using (FileStream streamFoo = File.OpenRead(@"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\ProjectTemplates\Extensibility\1033\VSShellTemplate\VSShellStubExe\Documentation\Images\AppEnv.jpg"))
using (FileStream streamBar = File.OpenRead(@"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\InstallShield\InstallShieldProject\1033\IS-text-200wide.jpg"))
using (FileStream output = File.OpenWrite(@"C:\Users\aam00\Desktop\foobar2.jpg"))
{
Image imageFoo = new Image(streamFoo);
Image imageBar = new Image(streamBar);
imageFoo.Blend(imageBar, 100);
imageFoo.Save(output);
}
This works, overlaying at (0,0).

This fails silently if the file already exists. Setting the stream length to 0 doesn't truncate it.
I also tried positioning the overlay:
imageFoo.Blend(imageBar, 100, new Rectangle(50, 30, imageBar.Width, imageBar.Height));
The Rectangle parameter doesn't behave as expected. Rather than being sizing for the positioned image, the width and height seem to crop the overlay relative to (0,0).

Sorry, didn't mean to. Was on my phone. Will have a proper look when I get to a desktop.
@Emyr42 You're absolutely correct. We need another parameter, most likely a rectangle, the first rectangle signifies the area of interest of the image to blend. The second would represent to location to drop the image.
My thought would be that if the second rectangle dimensions do not match that of the source image we would scale it.
What do you think?
Oh @Emyr42 meant to ask,
This fails silently if the file already exists. Setting the stream length to 0 doesn't truncate it.
What do you mean by this?
I don't think auto scaling would be good. I have a use case for this for TV/movie images; we have need for getting promotional images and then having to 'blend', with a transparency layer, a small channel attribution logo in the corner of the image so I need the images to retain their size and aspect.
Blend now supports setting the position and the size of the overlaid image. Composition is also premultiplied for better blending (I think I got the maths correct for that).

Hello, i cant seem to find .Blend() extension for "Image". I'm currently working with xamarin.mac project. Is there any replacement ?
DrawImage. We have API docs.
DrawImage. We have API docs.
thanks, ive ended up doing it like this :
img.Mutate(x => x.DrawImage(logo, new Point(1,1), opacity: 0.5f));
also, more examples would be nice. just having API docs is not sufficient.
also, more examples would be nice. just having API docs is not sufficient.
We have a samples repo, thousands of reference unit tests and a discussions channel for asking and answering such questions.
You however chose to ignore all of the above and spam an old closed issue instead. Maybe if you took the time time and effort to actually read you would be better off.