MateuszŁ#33352
Is it possible to perform the following operations using the "memory friendly" method?
but I don't know how to overlay a PNG on my main bitmap
i tried to do it like this:
- read JPG
- read PNG
- crop JPG
- resize JPG
- sharpen JPG
- auto contrast JPG
- draw PNG on JPG << I don't know how to do that
- 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();
}