I'm trying to add a small image to a blank canvas, and then overlay a translucent background image (the same size as the canvas) over all this. And then output as a .gif file.
Here' the code I'm using, the file I get in the end is just the smaller sized image.
Here' the code I'm using, the file I get in the end is just the smaller sized image.
using (var images = new MagickImageCollection())
{
using (var canvas = new MagickImage(new MagickColor(Color.Gray), 300, 300))
{
smallImage.Resize(90, 90);
var smallImageDraw = new Drawables();
smallImageDraw.Draw(smallImage);
smallImageDraw.Point(100,100);
smallImageDraw.Rotation(-50);
canvas.Draw(smallImageDraw);
images.Add(smallImage);
var bgImage = new MagickImage(FileSystem.GetFullPath(frameData.Item.FilePath));
var bgDraw = new Drawables();
bgDraw.Draw(bgImage);
bgDraw.Point(canvas.Width, canvas.Height);
canvas.Draw(bgDraw);
images.Add(canvas);
images.Mosaic();
}
using (var frameMs = new MemoryStream())
{
images.Write(frameMs, MagickFormat.Png);
frameMs.Position = 0;
var fileName = string.Format("layers/{2}-{0}-{1:dd-MM-yyyy-hh-mm-ss}.png", Guid.NewGuid(), DateTime.Now, frameData.Index);
FileSystem.AddFile(fileName, frameMs);
gifFrames.Add(fileName, frameData.Item.Delay);
}
}
Is sometihng being done in the wrong order? Or is Drawable the wrong thing to be using?