Page 1 of 1

spend too much time on merge gif

Posted: 2015-12-17T09:19:05-07:00
by jinonline
Hi.
sorry, My English is pretty limited, please don't mind

in my case, I need to merge some picture to gif, Each picture about 120kb or more
my code sample:

Code: Select all

string[] photos = Directory.GetFiles(path, "*.jpg");
using (MagickImageCollection collection = new MagickImageCollection())
{
  int iarray = 0;
  foreach (string name in photos)
    {
      collection.Add(name);
      collection[iarray].AnimationDelay = 0;
      iarray++;
    }

    QuantizeSettings settings = new QuantizeSettings();
    settings.Colors = 256;
    collection.Quantize(settings);

    collection.Optimize();
    collection.Write("imagemagick.gif");
}
20 photos in directory, total file size about 3mb
when i start project, it need spend 1min and imagemagick.gif file size 8.xmb

Q1, is it normal?? 1min too long ...
Q2, why file become to bigger? (3mb=>8mb)

Thank you

Re: spend too much time on merge gif

Posted: 2015-12-18T02:21:45-07:00
by dlemstra
The size of the file does not really matter. What are the dimensions (width/height) of your input images?

Re: spend too much time on merge gif

Posted: 2015-12-18T04:06:31-07:00
by jinonline
dlemstra wrote:The size of the file does not really matter. What are the dimensions (width/height) of your input images?
hi
image dimensions is 700x700
when i remove these code
--------
QuantizeSettings settings = new QuantizeSettings();
settings.Colors = 256;
collection.Quantize(settings);
---------
Speed will become faster 20~30%~
but file size still too big~