NEF to JPG apache error.

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
circleb
Posts: 4
Joined: 2015-03-26T15:53:56-07:00
Authentication code: 6789

NEF to JPG apache error.

Post by circleb »

I'm trying to convert an .NEF to a .JPG with php on a local testing site being served from my computer.
I can do the conversion from terminal no problem, but my PHP/Apache site gives me this error:

Code: Select all

PHP Fatal error:  Uncaught exception 'ImagickException' with message 'unable to open image `/var/tmp/magick-55934Og9gB9rb6P.ppm': No such file or directory @ error/blob.c/OpenBlob/2675' in /***/image.php:2\nStack trace:\n#0 /***/image.php(2): Imagick->__construct('DSC4741.nef')\n#1 {main}\n  thrown in /***/image.php on line 2
Here's my system info:
  • • ImageMagick 6.9.0-10 Q16 x86_64 2015-03-25
    • OS X Yosemite
I originally posted this: http://stackoverflow.com/questions/2927 ... magemagick but they finally told me I should try this forum.

Thanks in advance!
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: NEF to JPG apache error.

Post by magick »

The NEF coder depends on the ufraw-batch command-line program. Is that installed?
circleb
Posts: 4
Joined: 2015-03-26T15:53:56-07:00
Authentication code: 6789

Re: NEF to JPG apache error.

Post by circleb »

I installed ufraw with homebrew, does that include ufraw-bach?
circleb
Posts: 4
Joined: 2015-03-26T15:53:56-07:00
Authentication code: 6789

Re: NEF to JPG apache error.

Post by circleb »

I tried using exec() — to call the exact command that runs fine in terminal — from PHP (I was using Imagick() originally), but I'm getting this error in my apache log:

Code: Select all

convert: delegate failed `"ufraw-batch" --silent --create-id=also --out-type=png --out-depth=16 "--output=%u.png" "%i"' @ error/delegate.c/InvokeDelegate/1329.
convert: unable to open image `/var/tmp/magick-62951MgDuLgofUHxP.ppm': No such file or directory @ error/blob.c/OpenBlob/2675.
convert: no images defined `test2.png' @ error/convert.c/ConvertImageCommand/3212.
mogulman
Posts: 1
Joined: 2015-03-26T17:54:42-07:00
Authentication code: 6789

Re: NEF to JPG apache error.

Post by mogulman »

This worked for me:

<?php
$file = "C:/pics/image003.jpg";
$fileNef = "C:/pics/image003.nef";
$cmd2 = 'convert "' . $fileNef . '" "' . $file . '"';
shell_exec ($cmd2);
?>
circleb
Posts: 4
Joined: 2015-03-26T15:53:56-07:00
Authentication code: 6789

Re: NEF to JPG apache error.

Post by circleb »

mogulman wrote: $file = "C:/pics/image003.jpg";
$fileNef = "C:/pics/image003.nef";
$cmd2 = 'convert "' . $fileNef . '" "' . $file . '"';
shell_exec ($cmd2);
When I do that I get this error in my apache log:

Code: Select all

convert: delegate failed `"ufraw-batch" --silent --create-id=also --out-type=png --out-depth=16 "--output=%u.png" "%i"' @ error/delegate.c/InvokeDelegate/1329.
I've installed ufraw, dcraw and imagemagick with homebrew. WHen I run the commands via terminal they work great, but running them from a web page in apache gives me this error.

I also ran: `$ convert -list configure`, and `bzlib mpeg freetype jng jpeg lzma png xml zlib` are all that's listed as delegates.

I tried reinstalling imagemagick hoping that that would force it to pickup ufraw as a delegate, but nothing changed in the configure.xml file.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: NEF to JPG apache error.

Post by fmw42 »

Sounds like UFRAW either did not install properly, is missing some component or is installed at some other location than were IM expects it to be.

Did you install Imagemagick with Homebrew? If Homebrew is like MacPorts, any delegates get installed into a different locations from Imagemagick, if Imagemagick was installed manually or from binary and not with Homebrew/MacPorts, etc. Note that I know nothing about Homebrew and have never used it.

My standard procedure on my Mac OSX Snow Leopard is to install all the delegates needed using MacPorts and then install IM manually from source. That way I can keep current with IM. See my post at viewtopic.php?f=1&t=21502&p=88202&hilit ... rts#p88202

See also
http://www.imagemagick.org/script/advan ... lation.php
Post Reply