Reduce memory usage in im2gif.
Reduce memory usage in im2gif.

The use of unique(A,'rows') on the whole image stack at once causes massive memory usage when dealing with large images (Matlab 2017b). Running unique() on individual frames, then again on the results, drastically reduces the memory usage and slightly improves the execution time.
dcherian/export_fig,altmany/export_fig,dcherian/export_fig,altmany/export_fig