Imagick not loading images, with 'NoDecodeDelegateForThisImageFormat' error message

Martyn Ball picture Martyn Ball · Mar 21, 2014 · Viewed 20.6k times · Source

Trying to create a thumbnail, but i'm getting some errors and I have no experience with Imagick.

Here is my PHP:

<?php
try {
    $imagick = new Imagick();
    $imagick->readImage('C:\xampp\htdocs\ppa\032.JPG');
    $imagick->thumbnailImage(800, 800);
    $imagick->writeImage('032(2).JPG');
}
catch(Exception $e) {
    die('Error when creating a thumbnail: ' . $e->getMessage());
}
?>

I then get this error code:

Error when creating a thumbnail: NoDecodeDelegateForThisImageFormat `C:\xampp\htdocs\ppa\032.JPG' @ error/constitute.c/ReadImage/555

Here is some information I generated with some code, which I can't find again... :/

Array
(
    [GD Version] => bundled (2.1.0 compatible)
    [FreeType Support] => 1
    [FreeType Linkage] => with freetype
    [T1Lib Support] => 
    [GIF Read Support] => 1
    [GIF Create Support] => 1
    [JPEG Support] => 1
    [PNG Support] => 1
    [WBMP Support] => 1
    [XPM Support] => 1
    [XBM Support] => 1
    [JIS-mapped Japanese Font Support] => 
)

File information:

enter image description here enter image description here

Edit:

1. I get the error instantly, there is no delay at all.
2. Running commands directly from CMD works on the examples given from installation instructions. 

I have just copied the wizard.jpg from the ImageMagick folder to use in the above script instead, just incase there is a problem with my image, but I get the same error. 

**Edit 2**

   Format  Mode  Description
------------------------------------------------------------------------------
      3FR  r--   Hasselblad CFV/H3D39II
        A* rw+   Raw alpha samples
      AAI* rw+   AAI Dune image
       AI  rw-   Adobe Illustrator CS2
      ART* rw-   PFS: 1st Publisher Clip Art
      ARW  r--   Sony Alpha Raw Image Format
      AVI  r--   Microsoft Audio/Visual Interleaved
      AVS* rw+   AVS X image
        B* rw+   Raw blue samples
      BGR* rw+   Raw blue, green, and red samples
     BGRA* rw+   Raw blue, green, red, and alpha samples
      BIE* rw-   Joint Bi-level Image experts Group interchange format (1.6)
      BMP* rw-   Microsoft Windows bitmap image
     BMP2* -w-   Microsoft Windows bitmap image (V2)
     BMP3* -w-   Microsoft Windows bitmap image (V3)
      BRF* -w-   BRF ASCII Braille format
        C* rw+   Raw cyan samples
      CAL* rw-   Continuous Acquisition and Life-cycle Support Type 1
           Specified in MIL-R-28002 and MIL-PRF-28002
     CALS* rw-   Continuous Acquisition and Life-cycle Support Type 1
           Specified in MIL-R-28002 and MIL-PRF-28002
   CANVAS* r--   Constant image uniform color
  CAPTION* r--   Caption
      CIN* rw-   Cineon Image File
      CIP* -w-   Cisco IP phone image format
     CLIP* rw+   Image Clip Mask
CLIPBOARD* rw-   The system clipboard
     CMYK* rw+   Raw cyan, magenta, yellow, and black samples
    CMYKA* rw+   Raw cyan, magenta, yellow, black, and alpha samples
      CR2  r--   Canon Digital Camera Raw Image Format
      CRW  r--   Canon Digital Camera Raw Image Format
      CUR* rw-   Microsoft icon
      CUT* r--   DR Halo
      DCM* r--   Digital Imaging and Communications in Medicine image
           DICOM is used by the medical community for images like X-rays.  The
           specification, "Digital Imaging and Communications in Medicine
           (DICOM)", is available at http://medical.nema.org/.  In particular,
           see part 5 which describes the image encoding (RLE, JPEG, JPEG-LS),
           and supplement 61 which adds JPEG-2000 encoding.
      DCR  r--   Kodak Digital Camera Raw Image File
      DCX* rw+   ZSoft IBM PC multi-page Paintbrush
      DDS* rw+   Microsoft DirectDraw Surface
    DFONT* r--   Multi-face font package (Freetype 2.5.3)
      DNG  r--   Digital Negative
      DPX* rw-   SMPTE 268M-2003 (DPX 2.0)
           Digital Moving Picture Exchange Bitmap, Version 2.0.
           See SMPTE 268M-2003 specification at http://www.smtpe.org

     DXT1* rw+   Microsoft DirectDraw Surface
     DXT5* rw+   Microsoft DirectDraw Surface
      EMF  r--   Windows Enhanced Meta File
     EPDF  rw-   Encapsulated Portable Document Format
      EPI  rw-   Encapsulated PostScript Interchange format
      EPS  rw-   Encapsulated PostScript
     EPS2* -w-   Level II Encapsulated PostScript
     EPS3* -w+   Level III Encapsulated PostScript
     EPSF  rw-   Encapsulated PostScript
     EPSI  rw-   Encapsulated PostScript Interchange format
      EPT  rw-   Encapsulated PostScript with TIFF preview
     EPT2  rw-   Encapsulated PostScript Level II with TIFF preview
     EPT3  rw+   Encapsulated PostScript Level III with TIFF preview
      ERF  r--   Epson RAW Format
      FAX* rw+   Group 3 FAX
           FAX machines use non-square pixels which are 1.5 times wider than
           they are tall but computer displays use square pixels, therefore
           FAX images may appear to be narrow unless they are explicitly
           resized using a geometry of "150x100%".

     FITS* rw-   Flexible Image Transport System
  FRACTAL* r--   Plasma fractal image
      FTS* rw-   Flexible Image Transport System
        G* rw+   Raw green samples
       G3* rw-   Group 3 FAX
      GIF* rw+   CompuServe graphics interchange format
    GIF87* rw-   CompuServe graphics interchange format (version 87a)
 GRADIENT* r--   Gradual linear passing from one shade to another
     GRAY* rw+   Raw gray samples
   GROUP4* rw-   Raw CCITT Group4
     HALD* r--   Identity Hald color lookup table image
      HDR* rw+   Radiance RGBE image format
HISTOGRAM* -w-   Histogram of the image
      HRZ* rw-   Slow Scan TeleVision
      HTM* -w-   Hypertext Markup Language and a client-side image map
     HTML* -w-   Hypertext Markup Language and a client-side image map
      ICB* rw-   Truevision Targa image
      ICO* rw+   Microsoft icon
     ICON* rw-   Microsoft icon
     INFO  -w+   The image format and characteristics
   INLINE* r--   Base64-encoded inline images
      IPL* rw+   IPL Image Sequence
   ISOBRL* -w-   ISO/TR 11548-1 format
      J2C* rw-   JPEG-2000 Code Stream Syntax (2.0.0)
      J2K* rw-   JPEG-2000 Code Stream Syntax (2.0.0)
      JBG* rw+   Joint Bi-level Image experts Group interchange format (1.6)
     JBIG* rw+   Joint Bi-level Image experts Group interchange format (1.6)
      JNG* rw-   JPEG Network Graphics
           See http://www.libpng.org/pub/mng/ for details about the JNG
           format.
      JNX* r--   Garmin tile format
      JP2* rw-   JPEG-2000 File Format Syntax (2.0.0)
      JPC* rw-   JPEG-2000 Code Stream Syntax (2.0.0)
     JPEG* rw-   Joint Photographic Experts Group JFIF format (80)
      JPG* rw-   Joint Photographic Experts Group JFIF format (80)
      JPT* rw-   JPEG-2000 File Format Syntax (2.0.0)
     JSON  -w+   The image format and characteristics
        K* rw+   Raw black samples
      K25  r--   Kodak Digital Camera Raw Image Format
      KDC  r--   Kodak Digital Camera Raw Image Format
    LABEL* r--   Image label
        M* rw+   Raw magenta samples
      M2V  rw+   MPEG Video Stream
      M4V  rw+   Raw MPEG-4 Video
      MAC* r--   MAC Paint
      MAP* rw-   Colormap intensities and indices
     MASK* rw+   Image Clip Mask
      MAT  rw+   MATLAB level 5 image format
    MATTE* -w+   MATTE format
      MEF  r--   Mamiya Raw Image File
     MIFF* rw+   Magick Image File Format
      MNG* rw+   Multiple-image Network Graphics (libpng 1.6.10)
           See http://www.libpng.org/pub/mng/ for details about the MNG
           format.
     MONO* rw-   Raw bi-level bitmap
      MOV  rw+   MPEG Video Stream
      MP4  rw+   MPEG-4 Video Stream
      MPC* rw+   Magick Persistent Cache image format
     MPEG  rw+   MPEG Video Stream
      MPG  rw+   MPEG Video Stream
      MRW  r--   Sony (Minolta) Raw Image File
      MSL* rw+   Magick Scripting Language
     MSVG  rw+   ImageMagick's own SVG internal renderer
      MTV* rw+   MTV Raytracing image format
      MVG* rw-   Magick Vector Graphics
      NEF  r--   Nikon Digital SLR Camera Raw Image File
      NRW  r--   Nikon Digital SLR Camera Raw Image File
     NULL* rw-   Constant image of uniform color
        O* rw+   Raw opacity samples
      ORF  r--   Olympus Digital Camera Raw Image File
      OTB* rw-   On-the-air bitmap
      OTF* r--   Open Type font (Freetype 2.5.3)
      PAL* rw-   16bit/pixel interleaved YUV
     PALM* rw+   Palm pixmap
      PAM* rw+   Common 2-dimensional bitmap format
    PANGO* r--   Pango Markup Language (Pangocairo 1.36.0)
  PATTERN* r--   Predefined pattern
      PBM* rw+   Portable bitmap format (black and white)
      PCD* rw-   Photo CD
     PCDS* rw-   Photo CD
      PCL  rw+   Printer Control Language
      PCT* rw-   Apple Macintosh QuickDraw/PICT
      PCX* rw-   ZSoft IBM PC Paintbrush
      PDB* rw+   Palm Database ImageViewer Format
      PDF  rw+   Portable Document Format
     PDFA  rw+   Portable Document Archive Format
      PEF  r--   Pentax Electronic File
      PES* r--   Embrid Embroidery Format
      PFA* r--   Postscript Type 1 font (ASCII) (Freetype 2.5.3)
      PFB* r--   Postscript Type 1 font (binary) (Freetype 2.5.3)
      PFM* rw+   Portable float format
      PGM* rw+   Portable graymap format (gray scale)
    PICON* rw-   Personal Icon
     PICT* rw-   Apple Macintosh QuickDraw/PICT
      PIX* r--   Alias/Wavefront RLE image format
    PJPEG* rw-   Joint Photographic Experts Group JFIF format (80)
   PLASMA* r--   Plasma fractal image
      PNG* rw-   Portable Network Graphics (libpng 1.6.10)
           See http://www.libpng.org/ for details about the PNG format.
    PNG00* rw-   PNG inheriting bit-depth and color-type from original
    PNG24* rw-   opaque or binary transparent 24-bit RGB (zlib 1.2.7)
    PNG32* rw-   opaque or transparent 32-bit RGBA
    PNG48* rw-   opaque or binary transparent 48-bit RGB
    PNG64* rw-   opaque or transparent 64-bit RGBA
     PNG8* rw-   8-bit indexed with optional binary transparency
      PNM* rw+   Portable anymap
      PPM* rw+   Portable pixmap format (color)
  PREVIEW* -w-   Show a preview an image enhancement, effect, or f/x
       PS  rw+   PostScript
      PS2* -w+   Level II PostScript
      PS3* -w+   Level III PostScript
      PSB* rw+   Adobe Large Document Format
      PSD* rw+   Adobe Photoshop bitmap
     PTIF* rw+   Pyramid encoded TIFF
      PWP* r--   Seattle Film Works
        R* rw+   Raw red samples
RADIAL-GRADIENT* r--   Gradual radial passing from one shade to another
      RAF  r--   Fuji CCD-RAW Graphic File
      RAS* rw+   SUN Rasterfile
      RGB* rw+   Raw red, green, and blue samples
     RGBA* rw+   Raw red, green, blue, and alpha samples
     RGBO* rw+   Raw red, green, blue, and opacity samples
      RGF* rw-   LEGO Mindstorms EV3 Robot Graphic Format (black and white)
      RLA* r--   Alias/Wavefront image
      RLE* r--   Utah Run length encoded image
      RMF  r--   Raw Media Format
      RW2  r--   Panasonic Lumix Raw Image
      SCR* r--   ZX-Spectrum SCREEN$
      SCT* r--   Scitex HandShake
      SFW* r--   Seattle Film Works
      SGI* rw+   Irix RGB image
    SHTML* -w-   Hypertext Markup Language and a client-side image map
SPARSE-COLOR* -w+   Sparse Color
      SR2  r--   Sony Raw Format 2
      SRF  r--   Sony Raw Format
  STEGANO* r--   Steganographic image
      SUN* rw+   SUN Rasterfile
      SVG  rw+   Scalable Vector Graphics (RSVG 2.40.1)
     SVGZ  rw+   Compressed Scalable Vector Graphics (RSVG 2.40.1)
     TEXT* rw+   Text
      TGA* rw-   Truevision Targa image
THUMBNAIL* -w+   EXIF Profile Thumbnail
     TIFF* rw+   Tagged Image File Format (LIBTIFF, Version 4.0.3)
   TIFF64* rw-   Tagged Image File Format (64-bit) (LIBTIFF, Version 4.0.3)
     TILE* r--   Tile image with a texture
      TIM* r--   PSX TIM
      TTC* r--   TrueType font collection (Freetype 2.5.3)
      TTF* r--   TrueType font (Freetype 2.5.3)
      TXT* rw+   Text
     UBRL* -w-   Unicode Text format
      UIL* -w-   X-Motif UIL table
     UYVY* rw-   16bit/pixel interleaved YUV
      VDA* rw-   Truevision Targa image
    VICAR* rw-   VICAR rasterfile format
      VID* rw+   Visual Image Directory
     VIFF* rw+   Khoros Visualization image
      VST* rw-   Truevision Targa image
     WBMP* rw-   Wireless Bitmap (level 0) image
     WEBP* rw-   WebP Image Format (libwebp 0.3.1)
      WMF  r--   Windows Meta File
      WMV  rw+   Windows Media Video
      WPG* r--   Word Perfect Graphics
      X3F  r--   Sigma Camera RAW Picture File
      XBM* rw-   X Windows system bitmap (black and white)
       XC* r--   Constant image uniform color
      XCF* r--   GIMP image
      XPM* rw-   X Windows system pixmap (color)
      XPS  r--   Microsoft XML Paper Specification
       XV* rw+   Khoros Visualization image
        Y* rw+   Raw yellow samples
    YCbCr* rw+   Raw Y, Cb, and Cr samples
   YCbCrA* rw+   Raw Y, Cb, Cr, and alpha samples
      YUV* rw-   CCIR 601 4:1:1 or 4:2:2

* native blob support
r read support
w write support
+ support for multiple images

Edit 3

C:\Users\Martyn Ball>identify "C:/xampp/htdocs/ppa/wizard.jpg"

C:/xampp/htdocs/ppa/wizard.jpg JPEG 265x352 265x352+0+0 8-bit sRGB 68.3KB 0.000u 0:00.017

Edit 4

Code run:

<?php
print_r(Imagick::queryFormats());
?>

Result:

Array ( )

Edit 5 I installed Imagick using the normal installer from their website (32bit), then I finally managed to find a dll which would work as there doesn't seem to be a reliable download section on ImageMagick's website for the DLL's.

Here is what phpinfo() displays about Imagick. enter image description here

Edit 6 I have read the following website and here is what it suggests to do, and what I have do after.

  1. If you download a DLL, make sure it is compiled with the same version of visual studio as Apache and PHP (Probably VC11 for PHP 5.5)
  2. Download with thread safety or no thread safety as per your setup
  3. Copy the DLL to your extensions folder
  4. Enable the extension in php.ini
  5. Download and install ImageMagick, make sure to select the version that comes with the dynamic link libraries, also make sure it is built for the same platform as PHP and Apache (32/64bit), even if you have a 64-bit system, like me you will probably be running the 32-bit version of PHP and Apache
  6. Add the ImageMagick path to your systems PATH variable, the installer can do this for you, but check it in Advanced System Settings to make sure it is there
  7. Restart Apache
  8. Check php_info() to see that the extension is enabled and that is supports some image formats

My results 1. Downloaded: ImageMagick-6.8.8-9-Q16-x86-dll.exe - Found the dll file included in the install directory which was called "php_imagick.dll" and put it into C:/xampp/php/ext/

This resulted in the following error: httpd.exe - Entry Point Not Found The procedure entry point MagickGetImageAttribute could not be located in the dynamic link library CORE_RL_wand_.dll.

And this error too: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext\php_imagick.dll' - The specified procedure could not be found. 2. N/A 3. Copied to C:/xampp/php/ext/ 4. Enabled the extension: extension=php_imagick.dll 5. Again downloaded this version (I have 32bit PHP): ImageMagick-6.8.8-9-Q16-x86-dll.exe (Win32 dynamic at 16 bits-per-pixel) 6. enter image description here

  1. As said above, I now get errors, didn't before but may have been wrong dll.

Just tried the following as well, but I get the same errors: extension=C:/ImageMagick/php_imagick.dll

ImageMagick is installed in C:/ImageMagick.

ANSWER

It seems I may have been using the wrong version of the dll for my PHP and Apache version. I downloaded the following file, and changed the extension link to the install folder of ImageMagick instead of moving the dll t the php folder.

ImageMagick-6.6.5-10-Q8-windows-dll.exe

PHP 5.5.9.

Apache 2.4.7.

Answer

guari picture guari · Aug 16, 2016

Question is old but since this issue seems a bit hacky to solve also nowadays, I post here a quick solution:

If you're on Windows, you can find here a repository containing ImageMagick DLL.

After you successfully load php_imagick.dll extension in /php/ext/ folder

  1. print a phpinfo() page and watch the corresponding ImageMagick version reported under 'Imagick using ImageMagick library version' label
  2. then download the zip of that version of ImageMagick
    eg. for latest TS-VC11-x86 stable version:
    php_imagick v3.4.1 > ImageMagick-6.9.3-7-vc11-x86.zip
  3. finally, extract the downloaded zip, go to its bin folder and copy all IM_MOD_RL_...dll files and FILTER_...dll files to /apache/bin/ folder, then restart your server, finish!
    No need to run installers or change environment variables etc.