问题
As you can see, the image _IGP4559.DNG exists but Imagick can't open it.
JPEG images works just fine.readImage()
returns the same error.
Here is the image: http://files.patrikelfstrom.se/_IGP4559.DNG
I run this in the terminal to rule out all other variables.
$ ll /var/www/_IGP4559.DNG
-rw-rw-rw- 1 monsun monsun 11841201 May 17 03:37 /var/www/_IGP4559.DNG
$ php -a
Interactive mode enabled
php > new Imagick('/var/www/_IGP4559.DNG');
PHP Warning: Uncaught exception 'ImagickException' with message 'unable to open image `/tmp/magick-29917oe6CM9MIkN8A.ppm': No such file or directory @ error/blob.c/OpenBlob/2709' in php shell code:1
Stack trace:
#0 php shell code(1): Imagick->__construct('/var/www/_IGP45...')
#1 {main}
thrown in php shell code on line 1
回答1:
ImageMagick uses other programs to read some image formats, including DNG.
What is likely happening is that the program that ImageMagick expects to be able to use to read the DNG either isn't present on your system or isn't working correctly.
The file that lists these other programs is called delegates.xml
On my system the entry for DNG decoding is:
<delegate decode="dng:decode" command=""ufraw-batch" --silent --create-id=also --out-type=png --out-depth=16 "--output=%u.png" "%i""/>
i.e. it's trying to use the program 'ufraw-batch' to do the decoding, and like you're seeing it fails, as that program isn't usable on my system.
To solve this, you either need to install ufraw, or install a similar package that can convert files from the DNG format to a standard one that ImageMagick can read directly.
来源:https://stackoverflow.com/questions/30282523/imagick-is-unable-to-open-dng-images