public function getImagineImage()
    {
        if (null === $this->imagineImage) {
            $app = Application::getFacadeApplication();
            $resource = $this->getFileResource();
            $mimetype = $resource->getMimeType();
            $imageLibrary = $app->make(ImagineInterface::class);

            switch ($mimetype) {
                case 'image/svg+xml':
                case 'image/svg-xml':
                case 'text/plain':
                    if ($imageLibrary instanceof \Imagine\Gd\Imagine) {
                        try {
                            $imageLibrary = $app->make('image/imagick');
                        } catch (Exception $x) {
                            $this->imagineImage = false;
                        } catch (Throwable $x) {
                            $this->imagineImage = false;
                        }
                    }
                    break;
            }

            if (null === $this->imagineImage) {
                $metadataReader = $imageLibrary->getMetadataReader();
                if (!$metadataReader instanceof ExifMetadataReader) {
                    if ($app->make('config')->get('concrete.file_manager.images.use_exif_data_to_rotate_images')) {
                        try {
                            $imageLibrary->setMetadataReader(new ExifMetadataReader());
                        } catch (NotSupportedException $e) {
                        }
                    }
                }
                try {
                    $this->imagineImage = $imageLibrary->load($resource->read());
                } catch (FileNotFoundException $e) {
                    $this->imagineImage = false;
                }
            }
        }

        return $this->imagineImage ?: null;
    }