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 : Friday, May 5, 2017 2:24:00 PM(UTC)
Nifty

Rank: Advanced Member

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

I'm attempting to "optimize" animated gif's and things aren't working like I thought they would. Your description of "optimization" is exactly what I'm looking for, and can be found here on an older version of your SDK:

Version 5.5

I found the same page in your newer version here:

Version 9.1.7

But it doesn't mention the optimizations. I tried to set the GifWriter.IsOptimized property, but that didn't seem to work. Is there another way to achieve this functionality? Specifically the Bitmap cropping and Replacing some pixels with transparent ones that is found in version 5.5?

Any pointers would be greatly appreciated.

Kate D.  
#2 Posted : Thursday, May 11, 2017 1:19:16 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,

Actually, the Optimize property was removed from the newer versions of Graphics Mill. However, you can implement this algorithm yourself:

1) You need to find the difference between the previous frame and the current frame.You can achieve it using the Invert + CombineMode.And or you can just use CombineMode.Xor.

Code:

 {
            using (var bmp1 = new Aurigma.GraphicsMill.Bitmap(path + "1.jpg"))
            using (var bmp2 = new Aurigma.GraphicsMill.Bitmap(path + "2.jpg"))
               
            {
                bmp1.Draw(bmp2, 0, 0, CombineMode.Xor);
                bmp1.Save(path + "diff.png");
                Aurigma.GraphicsMill.Transforms.AutoCrop autoCrop = new AutoCrop(RgbColor.Black);
                Aurigma.GraphicsMill.Pipeline.Run(bmp1 + autoCrop + bmp2);
                Console.Write("{0}, {1}, {2}, {3}", autoCrop.Result.X, autoCrop.Result.Y, autoCrop.Result.Width, autoCrop.Result.Height);
                Console.ReadKey();
                bmp2.Save(path + "diff2.png");
             }

            return;

2) Then you need to use AutoCrop in order to find the bounding rectangle for cropping.

3) You need to use this rectangle for cropping the current frame.

4) You need to save this cut frame into the gif with specifying coordinates (x,y) and disposalMode.

Hope it helps.

Please let me know if you have any questions.

Best regards,

Kate

Nifty  
#3 Posted : Thursday, May 11, 2017 8:18:33 AM(UTC)
Nifty

Rank: Advanced Member

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

Thanks for the direction. I've found the GraphicsMill SDK to be very helpful, keep up the good work.
Users browsing this topic
Guest (3)
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.