public static function createFromFile($imageFile)
{
$imageFile = realpath($imageFile);
if (!file_exists($imageFile)) {
throw new \Exception(sprintf('Could not open image file "%s"', $imageFile));
}
$imagick = new \Imagick(realpath($imageFile));
$animated = false;
if ($imagick->getImageIterations() > 0) {
$animated = true;
}
return new self($imagick, $imageFile, $imagick->getImageWidth(), $imagick->getImageHeight(), $imagick->getImageFormat(), $animated);
}