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

Notification

Icon
Error

Options
Go to last post Go to first unread
Nifty  
#1 Posted : Thursday, May 11, 2017 8:49:29 AM(UTC)
Nifty

Rank: Advanced Member

Groups: Guest
Joined: 10/12/2015(UTC)
Posts: 44

My "back.gif" is always Format8bppIndexed, and if there is no transparency then the following works and looks great:

Code:

using (var back = new Aurigma.GraphicsMill.Bitmap("base.gif"))
using (var overlay = new Aurigma.GraphicsMill.Bitmap("overlay.gif")) {
    back.Draw(overlay, 0, 0, Aurigma.GraphicsMill.Transforms.CombineMode.Copy);
}

But if the "overlay.gif" has transparent pixels the CombineMode.Copy doesn't work, so I'm using CombineModel.Alpha. I'm also converting to Format32bppArgb so I don't get the "UnsupportedPixelFormatException"

Code:

using (var back = new Aurigma.GraphicsMill.Bitmap("base.gif"))
using (var overlay = new Aurigma.GraphicsMill.Bitmap("overlay.gif")) {
    back.ColorManagement.Convert(Aurigma.GraphicsMill.PixelFormat.Format32bppArgb);
    back.Draw(overlay, 0, 0, Aurigma.GraphicsMill.Transforms.CombineMode.Alpha);
}

The desired result is ALMOST there, but it's very pixelated. How can I make merge these two images and get a better result?

base.gifoverlay.gif

Kate D.  
#2 Posted : Thursday, May 11, 2017 11:15:48 PM(UTC)
Kate D.

Rank: Advanced Member

Groups: Guest
Joined: 10/20/2015(UTC)
Posts: 52

Was thanked: 14 time(s) in 13 post(s)
Hi Brian,

Could you please send me your GIF-files (base.gif and overlay.gif)?

Also, please send the full code snippet (I need to know what you are going to do next after drawing).

Thanks!

Best regards,

Kate

Nifty  
#3 Posted : Friday, May 12, 2017 7:07:00 AM(UTC)
Nifty

Rank: Advanced Member

Groups: Guest
Joined: 10/12/2015(UTC)
Posts: 44

I'm assuming your reply meant "It works for me, how are you messing this up". And you are correct, the code I originally posted is working fine, the problem is how I write it to disk. The following is for anyone else that runs across this similar problem:

I had a legacy method that turns an image into a byte array:

Code:

private static byte[] getGytes(Image img) {
    using (var stream = new MemoryStream()) {
        img.Save(stream, System.Drawing.Imaging.ImageFormat.Gif);
        return stream.ToArray();
    }
}

And I would call it like this:

Code:

var imageBytes = getGytes(back.ToGdiPlusBitmap());

I'm guessing the conversion to System.Drawing.Bitmap was the issue, because the following was my solution:

Code:

private static byte[] getGytes(Aurigma.GraphicsMill.Bitmap bmp) {
    using (var stream = new MemoryStream()) {
        bmp.Save(stream, new Aurigma.GraphicsMill.Codecs.GifSettings() { });
        return stream.ToArray();
    }
}

Now I just call the method without the "ToGdiPlusBitmap()"

Code:

var imageBytes = getGytes(back);

Thanks again for the great forum support.

Kate D.  
#4 Posted : Monday, May 15, 2017 12:16:54 AM(UTC)
Kate D.

Rank: Advanced Member

Groups: Guest
Joined: 10/20/2015(UTC)
Posts: 52

Was thanked: 14 time(s) in 13 post(s)
Hi Brian,

As far as I understood the problem was resolved.

Please let me know if you still have any problems with it.

Best regards,

Kate

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.