Search code examples
phpimagick

Imagick can't open RAW file


I'm trying to open ARW (Sony raw image format) file with Imagick like below:

$imgOriginal =new Imagick();
file_put_contents($mptFile, $response->body);
$imgOriginal->setformat(strtolower(str_replace(".", "",$_typeFile)));            
$imgOriginal->readimage(__DIR__. DIRECTORY_SEPARATOR .$mptFile);

File itself is downloaded from amazon s3, placed on local disk and then I'm trying to convert it to jpeg. Everything works fine on Windows, but when I run that code on Linux server (Amazon EC2 instance), I'm getting error like below (readimage throws it):

Message: unable to open image `/tmp/magick-XX3txRwQ.ppm': No such file or directory @ blob.c/OpenBlob/2480

Originally, I were using readimageblob instead of readimage, but getting same issue with it.

It looks to me like it can't create some kind of temporary file, but I have nothing like open_basedir being set and /tmp folder is opened to everyone (its permission: drwxrwxrwx 3 root root)

At the same time, it works fine with JPEG files.

Is there any way to solve this problem?


Solution

  • After some research I've figured out that I had no ufraw-batch tool being installed on my linux machine. And that is a tool which actually does RAW image processing.

    I've installed it and now everything works fine to me.