How to add support for the JPEG image format
Solution 1
I fixed the problem by installing from source the jpeg encoding library available at http://www.ijg.org/files/jpegsrc.v8c.tar.gz.
cd /usr/local/src
tar xvfz jpeg-8c.tar.gz
cd jpeg-8c
./configure --enable-shared --prefix=$CONFIGURE_PREFIX
make
sudo make install
Then I re-installed ImageMagick from source:
cd /usr/local/src
tar xvfz ImageMagick-6.6.9-5.tar.gz
cd ImageMagick-6.6.9-5
export CPPFLAGS=-I/usr/local/include
export LDFLAGS=-L/usr/local/lib
./configure --prefix=/usr/local --disable-static --with-modules --without-perl --without-magick-plus-plus --with-quantum-depth=8 --disable-openmp
make
sudo make install
Now its working, I've tested it like this:
sam@ubuntu:~/RubymineProjects/project/tmp$ identify 1.jpg
1.jpg JPEG 128x106 128x106+0+0 8-bit sRGB 2.22KB 0.000u 0:00.000
Solution 2
If you decide to build ImageMagick from source, you need to be prepared to manually resolve all dependencies. Unless you have a pressing need, you should install all software on Ubuntu from a repository -- either the official repos or a PPA.
If you install Imagemagick using APT (apt-get
, Synaptic, Software Center, etc.), then JPG files will work just fine, as I confirmed on my machine.
If your reason for building from source is to get a more recent version, hunt for a PPA that tracks the most recent version. If you're building from source in order to help with development, then you should find out from the Imagemagick folks just what is required to succesfully build it from source. It might be that you need to specify some flag to ./configure
or have some development library installed before running ./configure
.
But normally, building from source just needlessly complicates things.
Oh, by the way, Red Hat and Ubuntu use different names for packages. So if yum
complains about a missing package, it shouldn't be surprising if apt-get
can't find a package by that name. You shouldn't mix package managers on a system unless you have a really good reason to do so. Even then, try every other option first.
Solution 3
Note that the no decode delegate
error can (quite confusingly) result from imagemagick (or some part of it) not finding the file. So before running to reinstall imagemagick, check with identify -list format
and convert -list configure
whether the JPEG format is supported, and if it is, the problem will probably be somewhere else.
For example, convert -resize 50% foo\ bar.jpg
gave me a no decode delegate for this image format
eror, but convert -resize 50% 'foo bar.jpg'
worked perfectly.
Solution 4
If you have just installed php5-imagick, try also installing the full imagemagick package. This will install all required libraries, such as the jpeg one.
sudo apt-get install imagemagick
Then restart your webserver to reload al libraries:
sudo service apache2 restart
JPEG decoding should now work without error.
Related videos on Youtube
Samir Sabri
I am a software architect, and I like to work on simulation projects, I have worked long time on developing educational applications.
Updated on September 18, 2022Comments
-
Samir Sabri over 1 year
After installing Imagemagick, I've tested it with jpg image, like this:
identify 1.jpg
But, I got this result:
identify: no decode delegate for this image format `1.jpg' @ error/constitute.c/ReadImage/550.
Then, I tried to add support for JPEG format by:
yum install libjpeg libjpeg-devel
but, I got:
Setting up Install Process No package libjpeg available. No package libjpeg-devel available. Nothing to do
I thought I need to update the apt-get, I did:
apt-get install libjpeg libjpeg-devel
but, I got:
Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package libjpeg E: Unable to locate package libjpeg-devel
Is there an easy way to get those libraries installed ? I am using Ubuntu 12.04.
-
thirtythreeforty over 11 yearsWhy are you using
yum
? That is the package manager for a different distribution (Red Hat & Fedora), and if you have usedyum
to install imagemagick, I'm not at all surprised it can't find the libraries! You should only install software with apt-get unless you really know what you're doing! Also, "Ubuntu 12" isn't specific enough... There are two versions of Ubuntu that start with "12": 12.04 and 12.10. Ubuntu versions are based on release date: 12.04 was released April (month #04) of '12, and 12.10 was released October of '12. Please be sure and specify! -
Samir Sabri over 11 yearsI have Ubuntu Release 12.04 (precise) 32-bit, I didn't install imagemagick with yum, instead I tar xvfz ImageMagick.tar.gz, cd ImageMagick-6.8.0, cd ImageMagick-6.8.0-4, ./configure, make, sudo make install, sudo ldconfig /usr/local/lib
-
Shashank Singla almost 9 yearstry apt-get install libjpeg-dev
-
Ernest Lee over 7 yearsIt's a really great answer there http://askubuntu.com/a/746195
-
Sridhar Sarnobat about 7 yearshow in the world can any imagemagick package be of ANY use without support for JPEG prepackaged?! That's like selling pizza without cheese or bread or tomato sauce.
-
-
Samir Sabri over 11 yearsI have no specific reason to building from source, if installing Imagemagick using APT (apt-get, Synaptic, Software Center, etc.) will fix the JPG files issue, I will go with it, can you please point me how to install Imagemagick using APT like you did ?
-
Scott Severance over 11 years@SamirSabri: Just search the Software Center or Synaptic. Or use tab completion on
apt-get
to discover the command:sudo apt-get install imagemagick
. -
Scott Severance over 11 yearsBy the way, I strongly suggest that you remove all previous attempts to install imagemagick before you try to install using my method. Otherwise, you might end up with conflicts.
-
Samir Sabri over 11 yearsAlthough I've removed previous attempts, I get an error when identify jpg image, like this: sam@ubuntu:~/RubymineProjects/project/tmp$ identify 1.jpg identify: no decode delegate for this image format `1.jpg' @ error/constitute.c/ReadImage/550.
-
Samir Sabri over 11 yearsI tried your solution, I got: Reading package lists... Done Building dependency tree Reading state information... Done libjpeg62 is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 6 not upgraded. But, I still get an error when identify jpg image: sam@ubuntu:~/RubymineProjects/project/tmp$ identify 1.jpg identify: no decode delegate for this image format `1.jpg' @ error/constitute.c/ReadImage/550.
-
Rishi Kolvekar over 11 yearsokay, I found this : blog.ericlamb.net/2008/11/… please, check and let me know, thanks for your reply.
-
Samir Sabri over 11 yearsI've just fixed it before reading your last comment, thanks, I have it in my answer below
-
Rishi Kolvekar over 11 yearssounds great !!! :)
-
Alex E over 11 yearsThis worked for me. I had to add export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/ in .profile
-
kyng almost 11 yearsI only installed the first jpegsrc from source and reinstalled ImageMagick via
apt-get
and it worked too. -
Mikko Rantalainen about 3 yearsNote that the last two examples with file called
foo bar.jpg
(with a space) should behave exactly the same because the backspace or single quotes are handled by the shell instead ofconvert
. There must have have been some typo in the first line, maybe NBSP instead of regular space in there somewhere?