Linux, FreeBSD, Juniper, Cisco / Network security articles and troubleshooting guides

FAQ
It is currently Tue Jul 16, 2019 2:48 pm


Username:
Subject:
Message body:
Enter your message here, it may contain no more than 60000 characters. 

Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :arrow: :| :mrgreen: :geek: :ugeek:
Font size:
 
Font colour
Options:
BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON
Disable BBCode
Disable smilies
Do not automatically parse URLs
Confirmation code
Confirmation code:
In an effort to prevent automatic submissions, we require that you enter both of the words displayed into the text field underneath.
     

Topic review - php gmagick No decode delegate for this image format JPG
Author Message
Post subject: php gmagick No decode delegate for this image format JPG  |  Post Posted: Wed Aug 28, 2013 4:39 am
After installing php gmagick module and graphicks magick utility using ./configure --enable-shared configure options, I ran into following php(I thought) error when trying to use graphicks magick to alter a JPG image:
Code:
No decode delegate for this image format (./imgs/_DSC2900.JPG)


This is because graphics magick ./configure --help does not show that you need to explicitly enable jpeg format support:
Code:
# ./configure --help 2>&1 | grep -iE "jpg|jpeg"
  --without-jpeg          disable JPEG support
  --without-jp2           disable JPEG v2 support

There are only options to disable JPEG support, not to enable it.

After running the ./configure graphics magick script, the status output was:
Code:
Options used to compile and link:
  CC       = gcc -std=gnu99
  CFLAGS   = -fopenmp -g -O2 -Wall -pthread
  CPPFLAGS = -I/usr/include/libxml2
  CXX      = g++
  CXXFLAGS = -pthread
  DEFS     = -DHAVE_CONFIG_H
  LDFLAGS  = -L/usr/lib
  LIBS     = -ljpeg -lpng12 -lxml2 -lz -lm -lgomp -lpthread


But after compiling and checking the gm binary:
Code:
# ldd `which gm`
        linux-vdso.so.1 =>  (0x00007fffd37ff000)
        libGraphicsMagick.so.3 => /usr/lib/libGraphicsMagick.so.3 (0x00007fabfd338000)
        libpng12.so.0 => /lib/libpng12.so.0 (0x00007fabfced8000)
        libxml2.so.2 => /usr/lib/libxml2.so.2 (0x00007fabfcb87000)
        libz.so.1 => /usr/lib/libz.so.1 (0x00007fabfc970000)
        libm.so.6 => /lib/libm.so.6 (0x00007fabfc6ed000)
        libgomp.so.1 => /usr/lib/libgomp.so.1 (0x00007fabfc4e0000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x00007fabfc2c4000)
        libc.so.6 => /lib/libc.so.6 (0x00007fabfbf61000)
        libdl.so.2 => /lib/libdl.so.2 (0x00007fabfbd5d000)
        librt.so.1 => /lib/librt.so.1 (0x00007fabfbb55000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fabfd7b4000)

... no jpeg library was linked to the binary... meaning that graphics magick was not supporting it...


Although, libjpeg-dev package was installed:
Code:
# dpkg -l | grep libjpeg
ii  libjpeg8                            8b-1                         The Independent JPEG Group's JPEG runtime library
ii  libjpeg8-dev                        8b-1                         Development files for the IJG JPEG library


Checking the configure script, I could see there is an option to enable JPEG support:
Code:
# grep with-jpeg configure
# Check whether --with-jpeg was given.
    DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS} --with-jpeg=$with_jpeg "
echo "JPEG v1           --with-jpeg=$with_jpeg          $have_jpeg"


Installing Graphics Magick the correct way:
1. Make sure autoconf and libjpeg-dev utilities are installed:
Code:
# dpkg -l | grep -E "autoconf|libjpeg"
ii  autoconf                            2.67-2                       automatic configure script builder
ii  libjpeg8                            8b-1                         The Independent JPEG Group's JPEG runtime library
ii  libjpeg8-dev                        8b-1                         Development files for the IJG JPEG library

2. Configure and install graphics magick:
Code:
# ./configure --enable-shared --with-jpeg
# make
# make install
# /path/to/php/pecl install gmagick-1.0.8b2


Checking the GM binary after installation:
Code:
# ldd `which gm`
        linux-vdso.so.1 =>  (0x00007fffa8fa0000)
        libGraphicsMagick.so.3 => /usr/lib/libGraphicsMagick.so.3 (0x00007f22009f0000)
        libjpeg.so.8 => /usr/lib/libjpeg.so.8 (0x00007f22007b7000)              --> JPEG library is now linked
        libpng12.so.0 => /lib/libpng12.so.0 (0x00007f2200590000)
        libxml2.so.2 => /usr/lib/libxml2.so.2 (0x00007f220023f000)
        libz.so.1 => /usr/lib/libz.so.1 (0x00007f2200028000)
        libm.so.6 => /lib/libm.so.6 (0x00007f21ffda5000)
        libgomp.so.1 => /usr/lib/libgomp.so.1 (0x00007f21ffb98000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x00007f21ff97c000)
        libc.so.6 => /lib/libc.so.6 (0x00007f21ff619000)
        libdl.so.2 => /lib/libdl.so.2 (0x00007f21ff415000)
        librt.so.1 => /lib/librt.so.1 (0x00007f21ff20d000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f2200e6c000)

Few commands to debug Graphics Magick format support and identify an image file:
Code:
# gm identify -verbose /path/to/file.JPG
# gm convert -list formats | grep -i jpeg
Jump to:  
News News Site map Site map SitemapIndex SitemapIndex RSS Feed RSS Feed Channel list Channel list


Delete all board cookies | The team | All times are UTC - 5 hours [ DST ]



phpBB SEO