Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
MateuszŁ  
#1 Posted : Tuesday, May 2, 2023 2:10:22 PM(UTC)
MateuszŁ

Rank: Newbie

Groups: Member
Joined: 2/7/2019(UTC)
Posts: 9

Thanks: 6 times
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:

Code:

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();
}
Eugene Kosmin  
#2 Posted : Wednesday, May 3, 2023 5:46:19 PM(UTC)
Eugene Kosmin

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 9/19/2006(UTC)
Posts: 505

Was thanked: 41 time(s) in 41 post(s)
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.
Best regards,
Eugene Kosmin
The Aurigma Development Team
thanks 1 user thanked Eugene Kosmin for this useful post.
MateuszŁ on 6/11/2023(UTC)
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.