This forum contains outdated content and is available for reading only. Please contact technical support if you have any questions.

Drawing overlay on bitmap in pipeline

Is it possible to perform the following operations using the "memory friendly" method?

  1. read JPG
  2. read PNG
  3. crop JPG
  4. resize JPG
  5. sharpen JPG
  6. auto contrast JPG
  7. draw PNG on JPG << I don't know how to do that
  8. save new file


but I don't know how to overlay a PNG on my main bitmap
i tried to do it like this:


using (var reader = ImageReader.Create(fileInput))
using (var overlay = ImageReader.Create(fileOverlay))
using (var crop = new Crop())
using (var resize = new Resize(3000, 2000, ResizeInterpolationMode.Lanczos))
using (var sharpen = new Sharpen(V.sharpnessValue))
using (var contrast = new Contrast() { Auto = true })
using (var drawer = new Aurigma.GraphicsMill.AdvancedDrawing.Drawer())
using (var writer = ImageWriter.Create(fileOutput))
{
    crop.OnInit += (sender, e) =>
    {
        var cropRectangle = MakeCropRectangle(sender, e);
        (sender as Crop).Rectangle = Rectangle.Round(cropRectangle);
    };

    drawer.Draw += delegate (object sender, DrawEventArgs e)
    {
        e.Graphics.DrawImage( ??? );
    };

    var pipeline = new Pipeline();

    pipeline.Add(reader);
    if (V.isCrop) pipeline.Add(crop);
    if (V.isSharpness) pipeline.Add(sharpen);
    pipeline.Add(resize);
    if (V.isAutoCorrect) pipeline.Add(contrast);
    pipeline.Add(drawer);
    pipeline.Add(writer);

    pipeline.Run();
}
Hi,

Please take a look at Combiner or Blender if you need to overlay images using blend modes. This way is more performant than using DrawImage from Drawer.