/**
  * @param ImageSavedEvent $event
  */
 public function onPngImageSaved(ImageSavedEvent $event)
 {
     if ($event->getImage()->mime() == "image/png" && $this->pngquantPath != "") {
         $builder = new ProcessBuilder(array($this->pngquantPath, '-f', '--speed', '1', '-o', $event->getImageFile()->getPathname(), $event->getImageFile()->getPathname()));
         $builder->getProcess()->run();
     }
 }
 /**
  * @param ImageSavedEvent $event
  */
 public function onJpegImageSaved(ImageSavedEvent $event)
 {
     if ($event->getImage()->mime() == "image/jpeg" && $this->jpegoptimPath != "") {
         $builder = new ProcessBuilder(array($this->jpegoptimPath, '-s', '-f', '-m90', $event->getImageFile()->getPathname()));
         $builder->getProcess()->run();
     }
 }