Minimize size of GIFs
Posted: 2017-04-19T11:47:03-07:00
I'm trying to create reasonably sized GIFs in C# using Magick.NET and succeeding in all but the "reasonably sized" area. My target gif size is 300x250. My design requirements are
1) A static background,
2) One (A) set of three images, ( 150x250) where the images, in sequence, move about the background, and
3) A second set (B) of three images (150x100) which move about the background independently of 2), but on the same time scale.
So, images A1 & B1 move about the background for 20 frames, images A2 & B2 move about for 20 frames, ...
My approach has been to create the sequence of 3*20 frames as bitmaps, where I place, e.g., A1 & B1 where they are supposed to be, then adding those (300x250) bitmaps to a MagickImageCollection. I finally Quantize(256), and OptimizePlus() the collection, then write it out. This results in a gif of 800K which is too large for my requirements.
Is there a way to create GIFS without using the brute-strength approach I've taken?
Thanks, Phil
1) A static background,
2) One (A) set of three images, ( 150x250) where the images, in sequence, move about the background, and
3) A second set (B) of three images (150x100) which move about the background independently of 2), but on the same time scale.
So, images A1 & B1 move about the background for 20 frames, images A2 & B2 move about for 20 frames, ...
My approach has been to create the sequence of 3*20 frames as bitmaps, where I place, e.g., A1 & B1 where they are supposed to be, then adding those (300x250) bitmaps to a MagickImageCollection. I finally Quantize(256), and OptimizePlus() the collection, then write it out. This results in a gif of 800K which is too large for my requirements.
Is there a way to create GIFS without using the brute-strength approach I've taken?
Thanks, Phil