getImageFormat() != 'JPEG') { $input = $input->coalesceImages(); } // turn images with colorspace 'GRAY' into 'SRGB' to avoid working on // greyscale colorspace images as this results images loosing color // information when placed into this image. if ($input->getImageColorspace() == Imagick::COLORSPACE_GRAY) { $input->setImageColorspace(Imagick::COLORSPACE_SRGB); } // create image object $image = new Image( $this->driver(), new Core($input) ); // discard animation depending on config if (!$this->driver()->config()->decodeAnimation) { $image->modify(new RemoveAnimationModifier()); } // adjust image rotatation if ($this->driver()->config()->autoOrientation) { $image->modify(new AlignRotationModifier()); } // set media type on origin $image->origin()->setMediaType($input->getImageMimeType()); return $image; } }