Page 1 of 1

PHP IMagick thinks NEF files are 160x120 TIFF

Posted: 2009-05-03T09:49:39-07:00
by lifebird64
Forgive me if this has been posted/resolved elsewhere, but I couldn't find it during my search. If it has been, please direct me to it.
-------------------

--- SUMMARY ---
I am not new to PHP, but very new to ImageMagick + PHP and admit I don't fully understand how delegations work.

I have no trouble working getting Imagick to work with JPEGs and PNGs. So far, I've only tried simple stuff (thumbnails, etc).

However, I am having trouble getting IMagick to work with NEF files. IMagic insists on open them as 160x120 TIFF.

For the record, most of my files are 3039x2014 NEF files made by my Nikon D40.

--- MY ENVIRONMENT ---
- OS & Software -
NetBSD 4.0
Apache 2.2.9
PHP 5.2.6
ImageMagick 6.3.6.1
dcraw 8.82
ufraw 0.13

- delegates.xml -
<delegate decode="nef" command='"/usr/pkg/bin/dcraw -w -c "%i" > "%o"' />

--- WHAT WORKS ---
> convert input.NEF output.JPEG
Produces a jpeg same size as the original NEF file.

--- WHAT DOESN'T WORK ---

Code: Select all

<?php try {
    $imageFilename = 'DSC_0007.NEF';
    $image = new Imagick();
    $image->pingImage($imageFilename);
    echo 'Height: ' . $image->getImageHeight() . "<br />\n";
    echo 'Width: ' . $image->getImageWidth() . "<br />\n";
    echo 'Format: ' . $image->getImageFormat() . "<br />\n";
} catch(Exception $except) {
    echo $except->getMessage(); } ?>
PHP Script Results wrote: Height: 120
Width: 160
Filetype: TIFF
If I try the same script with $imageFilename = 'clouds39.jpg' , the format and dimensions returned match the original file.

Please point me in the right direction here. What am I doing wrong?

Re: PHP IMagick thinks NEF files are 160x120 TIFF

Posted: 2009-05-04T05:53:32-07:00
by mkoppanen
Hi,

can you link me to example NEF image?

Re: PHP IMagick thinks NEF files are 160x120 TIFF

Posted: 2009-05-04T14:20:10-07:00
by lifebird64

Re: PHP IMagick thinks NEF files are 160x120 TIFF

Posted: 2009-05-04T16:44:50-07:00
by magick
We're using ImageMagick 6.5.2-0 and Imagick 2.2.2-2. We get the expected results:
  • Height: 2014<br />
    Width: 3039<br />
    Format: NEF<br />

Re: PHP IMagick thinks NEF files are 160x120 TIFF

Posted: 2009-05-04T19:42:44-07:00
by lifebird64
That must be it. I'm running the latest version of Imagick (2.3.0RC1), but I've got an old version of ImageMagick (6.3.6.1).

I'll update this post after I've installed the new version, but I think you've nailed it.

Many thanks.

Re: PHP IMagick thinks NEF files are 160x120 TIFF

Posted: 2009-05-05T09:59:42-07:00
by lifebird64
ImageMagick 6.4.8
iMagick 2.2.2

Height2014
Width3039
FiletypeNEF

:D

For the record, I got lazy and installed version 6.4.8 from NetBSD's package source collection, than recompiled iMagick 2.2.2. Not the latest version, but it still worked.

Thanks again for all your help.