ImageMagick (PerlMagick) Problem/Quest

Not sure if anyone in this group is familiar with ImageMagick...

I have successfully installed the software and have a test working for reading, manipulating a GIF file.

I just tried a similar thing with a JPEG file and got the following error, which was spawned when attempting to Read the file using IM/PM:

Warning 320: no delegate for this image format (JPG) [No such file or directory]

I read the docs about delegates, installed the required jpeg library successfully, recompiled/installed ImageMagick (it reported jpeg being successfully included)  and then tried my tst again. It still reports the above error.

Any ideas what needs to be done?

Thanks ,
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

icculusAuthor Commented:
Forgot to add the following info:

I have a RedHat 5.2 system, Perl 5.003 installed, and ImageMagick 4.2.9
Hmmmm - it may be that the delegates.mgk file (in my case installed in /usr/local/share/ImageMagick/delegates.mgk) still lists a delegate for JPG (djpeg in particular). Can you show us what the delegates.mgk file looks like and whether you see any references to JPG/JPEG?

icculusAuthor Commented:
There are no references to jpg, jpeg, JPG or JPEG (sorry, had to be exhaustive) in the delegates.mgk file. I can still post it if you wish to see it, just let me know.

I pondered the concept that I would have to add something to the file for handling jpeg but haven't the slightest idea what to add or the format - was especially confused after looking at some of the other examples... The documentation doesn't really cover this stuff, wish it did... ;)

Is the above my problem? Do I need to add a _handler_ in that file? If so, any tips on the format to use?

BTW - In the Makefile in the delegates directory I see this:

DELEGATES =  jpeg png tiff zlib

But thats the only trace of jpg (jpeg) in that directory.

HTML5 and CSS3 Fundamentals

Build a website from the ground up by first learning the fundamentals of HTML5 and CSS3, the two popular programming languages used to present content online. HTML deals with fonts, colors, graphics, and hyperlinks, while CSS describes how HTML elements are to be displayed.

No need to add something Andy - I was just afraid that you had some "leftovers" from your old version in there (djpeg for example). So something went wrong when you updated ImageMagick and it doesn't recognize the newly linked jpg-library. Let's try to figure out what it is exactly complaining about.
On Solaris I have 'truss' which allows me to trace a programs system calls. I know you have something similar on Linux but I don't remember whether it is called 'strace' or 'trace' or 'ktrace'. Sure you know what I'm talking about.
I would run your (buggy) perl script again, but this time under "truss" and we're interested in the last few files (open or stat/fstat calls) which result in a "non-existant" error.

Makes sense?
icculusAuthor Commented:
Here is the output for strace running the program, the last chunk of output which is near the Read attempt...


stat("/home/sites/flinks/web/freakopedia/webcams/sea_serpent/night/sea_serp_nite_38.jpg", {st_mode=0, st_size=0, ...}) = 0
chdir("/home/sites/flinks/web/freakopedia/webcams/sea_serpent") = 0
time(NULL)                              = 944207820
open("/home/sites/flinks/web/freakopedia/webcams/sea_serpent/night/sea_serp_nite_38.jpg", O_RDONLY) = 3
fstat(3, {st_mode=0, st_size=0, ...})   = 0
mmap(0, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x4000c000
fstat(3, {st_mode=0, st_size=0, ...})   = 0
lseek(3, 8192, SEEK_SET)                = 8192
read(3, "\373\227\240\'\17F9\r\235\215\375"..., 3266) = 3266
lseek(3, 0, SEEK_SET)                   = 0
read(3, "\377\330\377\340\0\20JFIF\0\1\1\1"..., 4096) = 4096
lseek(3, -2432, SEEK_CUR)               = 1664
fstat(3, {st_mode=0, st_size=0, ...})   = 0
lseek(3, 8192, SEEK_SET)                = 8192
read(3, "\373\227\240\'\17F9\r\235\215\375"..., 4096) = 3266
close(3)                                = 0
munmap(0x4000c000, 4096)                = 0
brk(0x814c000)                          = 0x814c000
(*about 50 lines of these edited out*)
brk(0x8196000)                          = 0x8196000
open("/usr/local/share/ImageMagick/delegates.mgk", O_RDONLY) = 3
fstat(3, {st_mode=0, st_size=0, ...})   = 0
mmap(0, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x4000c000
read(3, "# ImageMagick delegates for Unix"..., 4096) = 4096
brk(0x8197000)                          = 0x8197000
(*more of these edited out*)
brk(0x81a6000)                          = 0x81a6000
read(3, "FER \\\n\t  -dTextAlphaBits=%u -"..., 4096) = 1671
brk(0x81a7000)                          = 0x81a7000
brk(0x81bd000)                          = 0x81bd000
read(3, "", 4096)                       = 0
brk(0x81be000)                          = 0x81be000
read(3, "", 4096)                       = 0
open("/delegates.mgk", O_RDONLY)        = -1 ENOENT (No such file or directory)
open("/home/gmd/.magick/delegates.mgk", O_RDONLY) = -1 ENOENT (No such file or directory)
open("delegates.mgk", O_RDONLY)         = -1 ENOENT (No such file or directory)
write(1, "IM: Reading file /home/sites/fli"..., 190IM: Reading file /home/sites/flinks/web/freakopedia/webcams/sea_serpent/night/sea_serp_nite_38.jpg, result=(Warning 320: no delegate for this image format (JPG) [No such file or directory])
) = 190


The last line is a comment I added to display the result of the Read attempt...

Looks to me like it opened the delegates file, didn't find what it was looking for and then tried some alternative locations... As to what it was looking for I have no clue...

Does this output tell you anything?


I can't figure why I doesn't understand JPG from the trace output above (thanks by the way). I just checked my local 4.2.8 installation and I don't see a reason why your would fail.

I know this may sound odd, but have you tried opening a ".jpeg" file (as opposed to a ".jpg" file)?

I do some testing here and check when you would run into the situation above.

icculusAuthor Commented:
Figures that some strange problem like this would fall in my lap... ;)

I did try to use a .jpeg extension and get a similar error:

Warning 320: no delegate for this image format (JPEG) [No such file or directory]

Don't think thats the problem, although I wish it were! ;)

Thanks for your help, I apprevcate your efforts!


I walked through the ImageMagick code and found the location where the "no delegate ...." message is spit out, but I don't have a clue why you run into in (see code below).

Could you do me two favours?
1.) Can I see the output from /usr/local/bin/convert (or whereever you installed the ImageMagick binaries)?
2.) Can you point me to the URL of one of the jpeg images? (you can send it to, if you don't want to publicize it here)


From image.c:

 magick_info=(MagickInfo *) GetMagickInfo(image_info->magick);
  if ((magick_info != (MagickInfo *) NULL) &&
      (magick_info->decoder != (Image *(*)(const ImageInfo *)) NULL))
    if (!GetDelegateInfo(image_info->magick,(char *) NULL,&delegate_info))
      MagickWarning(MissingDelegateWarning,"no delegate for this image format",
        unsigned int

          Let our decoding delegate process the image.
        if (image == (Image *) NULL)
          return((Image *) NULL);
        (void) strcpy(image->filename,image_info->filename);
          InvokeDelegate(image_info,image,image_info->magick,(char *) NULL);
        image=(Image *) NULL;
        if (status == False)
        magick_info=(MagickInfo *) GetMagickInfo(image_info->magick);
        if ((magick_info != (MagickInfo *) NULL) &&
            (magick_info->decoder != (Image *(*)(const ImageInfo *)) NULL))
            "no delegate for this image format",image_info->magick);
icculusAuthor Commented:
Ok, here is the output (the program was in the /usr/local/bin directory...)

--- - 129) /usr/local/bin/convert
Version: @(#)ImageMagick 4.2.9 99/09/01
Copyright: Copyright 1999 E. I. du Pont de Nemours and Company

Usage: convert [options ...] file [ files... ] output_file

Where options include:
  -adjoin              join images into a single multi-image file
  -antialias           remove pixel-aliasing
  -append              append an image sequence
  -average             average an image sequence
  -blur factor         apply a filter to blur the image
  -border geometry     surround image with a border of color
  -bordercolor color   border color
  -box color           color for annotation bounding box
  -charcoal factor     simulate a charcoal drawing
  -coalesce            merge a sequence of images
  -colorize value      colorize the image with the pen color
  -colors value        preferred number of colors in the image
  -colorspace type     alternate image colorspace
  -comment string      annotate image with comment
  -compress type       type of image compression
  -contrast            enhance or reduce the image contrast
  -crop geometry       preferred size and location of the cropped image
  -cycle amount        cycle the image colormap
  -delay value         display the next image after pausing
  -deconstruct         break down an image sequence into constituent parts
  -density geometry    vertical and horizontal density of the image
  -depth value         depth of the image
  -despeckle           reduce the speckles within an image
  -display server      obtain image or font from this X server
  -dispose method      GIF disposal method
  -dither              apply Floyd/Steinberg error diffusion to image
  -draw string         annotate the image with a graphic primitive
  -edge factor         apply a filter to detect edges in the image
  -emboss              emboss an image
  -enhance             apply a digital filter to enhance a noisy image
  -equalize            perform histogram equalization to an image
  -filter type         use this filter when resizing an image
  -flip                flip image in the vertical direction
  -flop                flop image in the horizontal direction
  -font name           X11 font for displaying text
  -frame geometry      surround image with an ornamental border
  -fuzz distance       colors within this distance are considered equal
  -gamma value         level of gamma correction
  -geometry geometry   perferred size or location of the image
  -gravity type        vertical and horizontal text placement
  -implode amount      implode image pixels about the center
  -interlace type      None, Line, Plane, or Partition
  -label name          assign a label to an image
  -layer type          Red, Green, Blue, Matte
  -linewidth value     width of line in pixels
  -label name          assign a label to an image
  -loop iterations     add Netscape loop extension to your GIF animation
  -map filename        transform image colors to match this set of colors
  -matte               store matte channel if the image has one
  -modulate value      vary the brightness, saturation, and hue
  -monochrome          transform image to black and white
  -morph value         morph an image sequence
  -negate              replace every pixel with its complementary color
  -noise               add or reduce noise in an image
  -normalize           transform image to span the full range of colors
  -opaque color        change this color to the pen color
  -page geometry       size and location of an image canvas
  -paint radius        simulate an oil painting
  -pen color           color for annotating or changing opaque color
  -pointsize value     pointsize of Postscript font
  -preview type        image preview type
  -profile filename    add ICC or IPTC information profile to image
  -quality value       JPEG/MIFF/PNG compression level
  -raise value         lighten/darken image edges to create a 3-D effect
  -region geometry     apply options to a portion of the image
  -roll geometry       roll an image vertically or horizontally
  -rotate degrees      apply Paeth rotation to the image
  -sample geometry     scale image with pixel sampling
  -scene value         image scene number
  -segment values      segment an image
  -seed value          pseudo-random number generator seed value
  -shade degrees       shade the image using a distant light source
  -sharpen factor      apply a filter to sharpen the image
  -shear geometry      slide one edge of the image along the X or Y axis
  -size geometry       width and height of image
  -solarize threshold   negate all pixels above the threshold level
  -spread amount       displace image pixels by a random amount
  -swirl degrees       swirl image pixels about the center
  -texture filename    name of texture to tile onto the image background
  -threshold value     threshold the image
  -transparent color   make this color transparent within the image
  -treedepth value     depth of the color classification tree
  -units type          Inch, Centimeter, or Undefined
  -verbose             print detailed information about the image
  -view                FlashPix viewing transforms
  -wave geometry       alter an image along a sine wave

By default, the image format of `file' is determined by its magic
number.  To specify a particular image format, precede the filename
with an image format name and a colon (i.e. ps:image) or specify the
image type as the filename suffix (i.e.  Specify 'file' as
'-' for standard input or output.

Here is a list of image formats recognized by ImageMagick.  Mode 'rw+'
means ImageMagick can read, write, and save more than one image of a
sequence to the same blob or file.

    Format  Mode  Description
       AVS*  rw+   AVS X image
       BMP*  rw+   Microsoft Windows bitmap image
     BMP24*  rw+   Microsoft Windows 24-bit bitmap image
      CMYK*  rw-   Raw cyan, magenta, yellow, and black bytes
       DCM*  r--   Digital Imaging and Communications in Medicine image
       DCX*  rw+   ZSoft IBM PC multi-page Paintbrush
       DIB*  rw+   Microsoft Windows bitmap image
      EPDF*  rw-   Encapsulated Portable Document Format
       EPI*  r--   Adobe Encapsulated PostScript Interchange format
       EPS*  rw-   Adobe Encapsulated PostScript
      EPS2*  rw-   Adobe Level II Encapsulated PostScript
      EPSF*  rw-   Adobe Encapsulated PostScript
      EPSI*  rw-   Adobe Encapsulated PostScript Interchange format
       EPT   rw-   Adobe Encapsulated PostScript with TIFF preview
       FAX*  rw+   Group 3 FAX
      FITS*  rw-   Flexible Image Transport System
        G3*  r--   Group 3 FAX
       GIF*  rw+   CompuServe graphics interchange format
     GIF87*  rw-   CompuServe graphics interchange format (version 87a)
 GRADATION*  r--   Gradual passing from one shade to another
   GRANITE   rw-   Granite texture
      GRAY*  rw+   Raw gray bytes
         H   rw-   Internal format
       HDF   rw+   Hierarchical Data Format
 HISTOGRAM*  rw-   Histogram of the image
       HTM*  -w-   Hypertext Markup Language with a client-side image map
      HTML   -w-   Hypertext Markup Language with a client-side image map
       ICB*  rw+   Truevision Targa image
       ICC*  rw-   ICC Color Profile
       ICO*  r--   Microsoft icon
  IMPLICIT*  ---   Internal format
      IPTC*  rw-   IPTC Newsphoto
       JPG*  rw-   Joint Photographic Experts Group JFIF format
      JPEG*  rw-   Joint Photographic Experts Group JFIF format
    JPEG24*  rw-   Joint Photographic Experts Group JFIF format
     LABEL*  r--   Text image format
      LOGO   rw-   ImageMagick Logo
       MAP*  rw-   Colormap intensities and indices
     MATTE*  rw+   Matte format
      MIFF*  rw+   Magick image format
       MNG*  rw+   Multiple-image Network Graphics
      MONO*  rw-   Bi-level bitmap in least-significant-byte first order
       MTV*  rw+   MTV Raytracing image format
  NETSCAPE   rw-   Netscape 216 color cube
      NULL*  r--   NULL image
        P7*  rw+   Xv thumbnail format
       PBM*  rw+   Portable bitmap format (black and white)
       PCD   rw-   Photo CD
      PCDS   rw-   Photo CD
       PCL*  rw-   Page Control Language
       PCT*  rw-   Apple Macintosh QuickDraw/PICT
       PCX*  rw-   ZSoft IBM PC Paintbrush
       PDF*  rw+   Portable Document Format
       PIC*  rw-   Apple Macintosh QuickDraw/PICT
      PICT*  rw-   Apple Macintosh QuickDraw/PICT
    PICT24*  rw-   24-bit Apple Macintosh QuickDraw/PICT
       PIX*  r--   Alias/Wavefront RLE image format
    PLASMA*  r--   Plasma fractal image
       PGM*  rw+   Portable graymap format (gray scale)
        PM*  rw-   X Windows system pixmap (color)
       PNG*  rw-   Portable Network Graphics
       PNM*  rw+   Portable anymap
       PPM*  rw+   Portable pixmap format (color)
   PREVIEW*  -w-   Show a preview an image enhancement, effect, or f/x
        PS*  rw+   Adobe PostScript
       PS2*  -w+   Adobe Level II PostScript
       PS3*  -w+   Adobe Level III PostScript
       PSD*  rw-   Adobe Photoshop bitmap
      PTIF   rw+   Pyramid encoded TIFF
       PWP*  r--   Seattle Film Works
       RAS*  rw+   SUN Rasterfile
       RGB*  rw+   Raw red, green, and blue bytes
      RGBA*  rw+   Raw red, green, blue, and matte bytes
       RLA*  r--   Alias/Wavefront image
       RLE   r--   Utah Run length encoded image
       SCT*  r--   Scitex HandShake
       SFW*  r--   Seattle Film Works
       SGI*  rw+   Irix RGB image
     SHTML   -w-   Hypertext Markup Language with a client-side image map
   STEGANO*  r--   Steganographic image
       SUN*  rw+   SUN Rasterfile
      TEXT*  rw+   Raw text
       TGA*  rw+   Truevision Targa image
       TIF   rw+   Tagged Image File Format
      TIFF   rw+   Tagged Image File Format
    TIFF24   rw+   24-bit Tagged Image File Format
      TILE*  r--   Tile image with a texture
       TIM*  r--   PSX TIM
       TXT*  rw+   Raw text
       UIL*  rw-   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
       XBM*  rw-   X Windows system bitmap (black and white)
        XC*  r--   Constant image of X server color
       XPM*  rw-   X Windows system pixmap (color)
        XV*  rw+   Khoros Visualization image
       YUV   rw-   CCIR 601 4:1:1

* native blob support

ImageMagick uses these delegates to read or write image formats it does not
directly support:

Decode-Tag   Encode-Tag  Delegate
          <= bzip        |bzip2
          <= compress    |/usr/bin/compress
          <= show        /usr/local/bin/display
          <= zip         |/bin/gzip
    browse =>            netscape
      bzip =>            |bzip2
       cgm =>            ralcgm
  compress =>            |/usr/bin/uncompress
       dot =>            dot
       dvi =>            dvips
      edit =>            xterm
       emf =>            wmftogif
       eps<=>pdf         gs
       eps<=>ps          gs
      file =>            /usr/bin/GET
       fig =>            fig2dev
       ftp =>            /usr/bin/GET
      gplt =>            /bin/echo
  gs-color =>            gs
   gs-mono =>            gs
      hpgl =>            hp2xx
       htm =>            html2ps
      html =>            html2ps
      http =>            /usr/bin/GET
      ilbm =>            /usr/bin/ilbmtoppm
       man =>            /usr/bin/groff
       mpg =>            mpeg2decode
       m2v =>            mpeg2decode
       pdf<=>eps         gs
       pdf<=>ps          gs
       pgp =>            pgpv
       pnm<= ilbm        /usr/bin/ppmtoilbm
       pnm<= launch      gimp
       pnm<= win         /usr/local/bin/display
       pov =>            povray
        ps<=>eps         gs
        ps<=>pdf         gs
        ps<= print       lp
       rad =>            ra_ppm
      rgba<= rle         /usr/local/bin/mogrify
      scan =>            scanimage
     shtml =>            html2ps
       txt<=>ps          enscript
       wmf =>            wmftogif
       xcf =>            xcftopnm
       yuv<= m2v         mpeg2encode
       yuv<= mpg         mpeg2encode
       zip =>            |/bin/gzip


I grepped that against jpg and then jpeg, and nothing came up... Is that a clue?

Url of image was just mailed to you!



the info from 'convert' looks ok- it shows JPG and JPEG, which means that ImageMagick knows about it.
I also look at the URL and the file displays properly using /usr/local/bin/display. So we can also rule out a "weird" JPG file. Now let's make one more test:

Try to use the image which fails in your perl-script and use ImageMagick's 'display' command to display it on the screen. If it comes up fine, then I suspect that your perl-installation of Image::Magick is out of sync. If this is the case you may need to do a "make install" in the PerlMagick subdirectory of your ImageMagick sources.

Hope this helps
icculusAuthor Commented:
Unfortunately I don't have console access and no way to get an X connection going... No way to test display that I know of... Any ideas?

icculusAuthor Commented:
BTW - not sure if this helps, here is the output of 'make test' in the PerlMagick directory...


[root@server1 PerlMagick]# make test
mkdir blib/lib
mkdir blib/lib/Image
mkdir blib/lib/auto
mkdir blib/lib/auto/Image
mkdir blib/lib/auto/Image/Magick
mkdir blib/man3
cp blib/lib/Image/
AutoSplitting blib/lib/Image/ (blib/lib/auto/Image/Magick)
Running Mkbootstrap for Image::Magick ()
chmod 644
LD_RUN_PATH="/usr/local/lib:/usr/lib:/lib" cc -o blib/arch/auto/Image/Magick/  -shared -L/usr/local/lib Magick.o    -L/usr/local/lib -L/tmp/ImageMagick-4.2.9/magick -lMagick -ltiff -ljpeg -lpng -lz -lm
chmod 755 blib/arch/auto/Image/Magick/
cp blib/arch/auto/Image/Magick/
chmod 644 blib/arch/auto/Image/Magick/
PERL_DL_NONLAZY=1 /usr/bin/perl -Iblib/arch -Iblib/lib -I/usr/lib/perl5/5.00503/
i386-linux -I/usr/lib/perl5/5.00503 -e 'use Test::Harness qw(&runtests $verbose); $verbose=0; runtests @ARGV;' t/*.t  t/jpeg/*.t t/png/*.t t/tiff/*.t t/zlib/*.t
t/read..............FAILED tests 6, 34, 38
        Failed 3/44 tests, 93.18% okay
t/write.............FAILED tests 6, 29
        Failed 2/32 tests, 93.75% okay
Failed Test  Status Wstat Total Fail  Failed  List of failed
t/read.t                     44    3   6.82%  6, 34, 38
t/write.t                    32    2   6.25%  6, 29
Failed 2/14 test scripts, 85.71% okay. 5/263 subtests failed, 98.10% okay.
make: *** [test_dynamic] Error 29


At least thats consistent, shows read and write failures...

icculusAuthor Commented:
Your suggestion helped...

I ended up going through all of the perl libraries and removing them, doing a complete new PerlMagick install and now it works...

My guess is all of those reinstalls never really replaced the non-working version... Now, if they had included a -UNINST option like other perl modules do maybe that would have simplified the process...

In any event, please post your last response as an answer so you can get some points for all of your time.

And once again, thank you for seeing this through with me!



glad to hear it finally worked. Here's my previous comment as an answer.



                                 the info from 'convert' looks ok- it shows JPG and JPEG, which means that ImageMagick knows
                                 about it.
                                 I also look at the URL and the file displays properly using /usr/local/bin/display. So we can
                                 also rule out a "weird" JPG file. Now let's make one more test:

                                 Try to use the image which fails in your perl-script and use ImageMagick's 'display' command
                                 to display it on the screen. If it comes up fine, then I suspect that your perl-installation of
                                 Image::Magick is out of sync. If this is the case you may need to do a "make install" in the
                                 PerlMagick subdirectory of your ImageMagick sources.

                                 Hope this helps

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
icculusAuthor Commented:
Thanks again for your time, appreciate your help very much! :)

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.