问题
I've upgraded my Homebrew ImageMagick to 6.9.4-7 version (Mac OS 10.11.5), after which it doesn't understand brackets in file names anymore.
This command should consider the first frame of a picture:
identify -format '%wx%h,1' 'some_pic.jpg[0]'
For JPG it is actually just the picture, so the command is equivalent to:
identify -format '%wx%h,1' 'some_pic.jpg'
The bracket command works fine on my Ubuntu server and worked before on my Mac. But now it fails with
identify: unable to open image `some_pic.jpg[0]':
No such file or directory @ error/blob.c/OpenBlob/2705.
Btw, this is the reason behind Paperclip::Errors::NotIdentifiedByImageMagickError on my local machine.
回答1:
Manually installing imagemagick-6.9.3-10 via brew has fixed the problem. So I believe it's a bug in imagemagick.
PS: To install specific version via brew, run
brew edit imagemagick
And edit these lines:
url "https://dl.bintray.com/homebrew/mirror/imagemagick-6.9.4-7.tar.xz"
mirror "https://www.imagemagick.org/download/ImageMagick-6.9.4-7.tar.xz"
sha256 "f54fc8dcdb328404d1f89ddebe75d603e22894d3786ca2f2a9677478135b4c86"
May not work if the version you choose (https://dl.bintray.com/homebrew/mirror/) is not compatible with the rest of the brew formula. Then you need to go deeper.
回答2:
Remove the quote from 'some_pic.jpg' and then try to execute the command. It should run fine.
来源:https://stackoverflow.com/questions/37646471/imagemagick-brackets-in-file-names-no-such-file-or-directory-mac-os-x