PHP IMagick thinks NEF files are 160x120 TIFF

IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
Post Reply
lifebird64

PHP IMagick thinks NEF files are 160x120 TIFF

Post 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?
mkoppanen
Posts: 309
Joined: 2007-06-09T07:06:32-07:00

Re: PHP IMagick thinks NEF files are 160x120 TIFF

Post by mkoppanen »

Hi,

can you link me to example NEF image?
Mikko Koppanen
My blog: http://valokuva.org
lifebird64

Re: PHP IMagick thinks NEF files are 160x120 TIFF

Post by lifebird64 »

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

Re: PHP IMagick thinks NEF files are 160x120 TIFF

Post 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 />
lifebird64

Re: PHP IMagick thinks NEF files are 160x120 TIFF

Post 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.
lifebird64

Re: PHP IMagick thinks NEF files are 160x120 TIFF

Post 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.
Post Reply