Missing delegate for "http"

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
acb764se
Posts: 5
Joined: 2019-09-25T07:12:38+00:00
Authentication code: 1152

Missing delegate for "http"

Post by acb764se »

Hello!
I need help with this command, that should read a picture from my own security camera:

convert "http://192.168.1.9/snapshot.cgi?user=user&pwd=user" /tmp/aPicture.jpg

It works perfectly on a Xubuntu 18 "Bionic Beaver" machine, but fails on a "minimal" Centos 6:

7th_guest:~>convert "http://192.168.1.9/snapshot.cgi?user=user&pwd=user" /tmp/aPicture.jpg
convert: unable to open image `//192.168.1.9/snapshot.cgi?user=user&pwd=user': No such file or directory @ error/blob.c/OpenBlob/2881.
convert: no decode delegate for this image format `HTTP' @ error/constitute.c/ReadImage/564.
convert: no images defined `/tmp/aPicture.jpg' @ error/convert.c/ConvertImageCommand/3235.

The IM version is the same, 6.9.10-68, compiled from source on both machines.
It looks like my minimal Centos6 is too minimal, and the "decode delegate" is missing.

Do you know which delegate is it, and how should I install it? On Centos 6 the network infrastructure exists, and it is functional:

7th_guest:~>curl "http://192.168.1.9/snapshot.cgi?user=user&pwd=user" -o /tmp/aPicture.jpg
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 35392 100 35392 0 0 395k 0 --:--:-- --:--:-- --:--:-- 432k

Thank you for any hints!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-03T00:14:51+00:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Missing delegate for "http"

Post by fmw42 »

I think your policy.xml file needs permission to do http: processing. There you will find

Code: Select all

 <!-- <policy domain="delegate" rights="none" pattern="HTTPS" /> -->
Uncomment and set the rights to read or read|write

What do you get from

Code: Select all

convert -version
on both systems in terms of delegates listed.
acb764se
Posts: 5
Joined: 2019-09-25T07:12:38+00:00
Authentication code: 1152

Re: Missing delegate for "http"

Post by acb764se »

Thanks for replying!
On Xubuntu: (a 64-bit PC)

convert --version
Version: ImageMagick 6.9.10-68 Q16 x86_64 2019-10-11 https://imagemagick.org
Copyright: © 1999-2019 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC OpenMP(4.5)
Delegates (built-in): bzlib djvu fftw fontconfig freetype jbig jng jpeg lcms lqr lzma openexr pangocairo png tiff wmf x xml zlib

On Centos_6: (a 32-bit VirtualBox guest of the above)
7th_guest:~/custodian>convert --version
Version: ImageMagick 6.9.10-68 Q16 i686 2019-10-18 https://imagemagick.org
Copyright: © 1999-2019 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC OpenMP(3.0)
Delegates (built-in): bzlib freetype jpeg tiff x zlib

Indeed the list of delegates is much shorter, and the openMP version (?) is different.
I found and changed 2 files "policy.xml", the good one should be the first (the second being under "doc"):

7th_guest:/tmp>tail /usr/local/./etc/ImageMagick-6/policy.xml /usr/local/./share/doc/ImageMagick-6/www/source/policy.xml
==> /usr/local/./etc/ImageMagick-6/policy.xml <==
<!-- <policy domain="resource" name="throttle" value="0"/> -->
<!-- <policy domain="resource" name="time" value="3600"/> -->
<!-- <policy domain="coder" rights="none" pattern="MVG" /> -->
<!-- <policy domain="module" rights="none" pattern="{PS,PDF,XPS}" /> -->
<policy domain="delegate" rights="none" pattern="HTTPS" />
<!-- <policy domain="path" rights="none" pattern="@*" /> -->
<!-- <policy domain="cache" name="memory-map" value="anonymous"/> -->
<!-- <policy domain="cache" name="synchronize" value="True"/> -->
<!-- <policy domain="cache" name="shared-secret" value="passphrase" stealth="true"/> -->
</policymap>

==> /usr/local/./share/doc/ImageMagick-6/www/source/policy.xml <==
<!-- <policy domain="resource" name="thread" value="4"/> -->
<!-- <policy domain="resource" name="throttle" value="0"/> -->
<!-- <policy domain="resource" name="time" value="3600"/> -->
<!-- <policy domain="coder" rights="none" pattern="MVG" /> -->
<policy domain="delegate" rights="none" pattern="HTTPS" />
<!-- <policy domain="path" rights="none" pattern="@*" /> -->
<!-- <policy domain="cache" name="memory-map" value="anonymous"/> -->
<!-- <policy domain="cache" name="synchronize" value="True"/> -->
<!-- <policy domain="cache" name="shared-secret" value="passphrase" stealth="true"/> -->
</policymap>

But still no success:

7th_guest:/tmp>convert "http://192.168.1.9/snapshot.cgi?user=user&pwd=user" aPicture.jpg
convert: unable to open image `//192.168.1.9/snapshot.cgi?user=user&pwd=user': No such file or directory @ error/blob.c/OpenBlob/2881.
convert: no decode delegate for this image format `HTTP' @ error/constitute.c/ReadImage/564.
convert: no images defined `aPicture.jpg' @ error/convert.c/ConvertImageCommand/3235.
acb764se
Posts: 5
Joined: 2019-09-25T07:12:38+00:00
Authentication code: 1152

SOLVED! Re: Missing delegate for "http"

Post by acb764se »

Solved!

Before posting here I had searched a bit in the web, and found hints that package xml was needed by IM in order to retrieve pictures from the web. But I _did_ have this package in CentOS6 (libxml2-something) so I was confused, and discounted those hints.

Looking today in the IM config.log file I discovered an error message relating to libxml2, so I ended up relooking at those hints, installed _also_ libxml2-devel (which _still_ does not have a .pc file, but has something better: the command xml2-config) like this:

yum install libxml2-devel

and now I can retrieve my pictures from a web URL. :D :D :D

Thanks in any case for the previous suggestions!
Post Reply