+ if (!getenv("SYNFIG_DISABLE_OPTIMIZE"))
+ {
+ synfig::info("optimizing layers");
+ try
+ {
+ image_list = OptimizeImageLayers(image_list,&exceptionInfo);
+ }
+ catch(Magick::Warning warning) {
+ synfig::warning("exception '%s'", warning.what());
+ }
+ }
+
+ if (!getenv("SYNFIG_DISABLE_OPTIMIZE_TRANS"))
+ {
+ synfig::info("optimizing layer transparency");
+ try
+ {
+ OptimizeImageTransparency(image_list,&exceptionInfo);
+ }
+ catch(Magick::Warning warning) {
+ synfig::warning("exception '%s'", warning.what());
+ }
+ }
+
+ synfig::info("recreating image list");
+ insertImages(&images, image_list);
+#else
+ synfig::info("not optimizing images");
+ // DeconstructImages is available in ImageMagic 6.2.* but it doesn't take
+ // the 'dispose' method into account, so for frames with transparency where
+ // nothing is moving, we end up with objects disappearing when they shouldn't
+
+ // linkImages(images.begin(), images.end());
+ // MagickLib::Image* new_images = DeconstructImages(images.begin()->image(),&exceptionInfo);
+ // unlinkImages(images.begin(), images.end());
+ // images.clear();
+ // insertImages(&images, new_images);
+#endif
+ }
+ else if (multiple_images)