Page 1 of 1

Cannot convert images from URL on Alpine Linux Edge

Posted: 2016-06-01T16:08:33-07:00
by darklow
I can't convert images directly from URL (both http and https) on Alpine Linux edge (docker container):

Version: 6.9.4.1-r0
https://pkgs.alpinelinux.org/package/ed ... magemagick

Code: Select all

convert http://duckduckgo.com/assets/logo_homepage.normal.v102.png d.png
convert: unable to open image `//duckduckgo.com/assets/logo_homepage.normal.v102.png': No such file or directory @ error/blob.c/OpenBlob/2702.
convert: no decode delegate for this image format `HTTP' @ error/constitute.c/ReadImage/501.
convert: no images defined `d.png' @ error/convert.c/ConvertImageCommand/3257.
These are my full dependencies:

Code: Select all

apk add --update python=2.7.11-r3 python-dev py-pip openssh supervisor git curl \
    imagemagick postgresql-dev gcc libjpeg musl-dev jpeg-dev zlib zlib-dev libxml2
Maybe some dependencies are missing if using newest version?
Or Syntax has been changed for opening images from URL?

Because it works on Alpine Linux v3.3 using imagemagick 6.9.3.4-r0
https://pkgs.alpinelinux.org/package/v3 ... magemagick

Thank you.

Re: Cannot convert images from URL on Alpine Linux Edge

Posted: 2016-06-01T16:51:46-07:00
by fmw42
check the read permissions on the file on that server for http://duckduckgo.com/assets/logo_homep ... l.v102.png. Some servers require password authentication.

For future reference see new security policies esp regarding https at viewtopic.php?f=4&t=29588

Although I do not think a delegate is involved, what do you get returned from

Code: Select all

convert -version
including the line about Delegates.

Note that in the dependencies you list, there is no libpng and you are trying to read and write png images. My guess is that is the issue. You have very few delegates. You might want to include more for example: libtif, freetype, fontconfig, ghostscript, lcms

Re: Cannot convert images from URL on Alpine Linux Edge

Posted: 2016-06-01T17:18:01-07:00
by darklow
fmw42 thanks for your reply.
I am also receiving same errors on JPG and any other remote files, so it can't be related to PNG lib.
And I also tried images from different domains and got same error.
Using curl and wget I can access same files that i cant open with convert.

And what is interesting:
1) convert: no decode delegate for this image format `HTTP' @ error/constitute.c/ReadImage/501.
It says it can't decode delegate for format HTTP?!
2) It works with previous version, but I am not expert enough to say what is difference between these two Alpine packages.
Maybe Alpine packagers changed some flags?
https://pkgs.alpinelinux.org/package/ed ... magemagick (edge + 6.9.4.1)
https://pkgs.alpinelinux.org/package/v3 ... magemagick (v3.3 + 6.9.3.4)

Convert version:

Code: Select all

convert --version
Version: ImageMagick 6.9.4-1 Q16 x86_64 2016-05-16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2016 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher Modules
Delegates (built-in): fontconfig freetype gslib jng jpeg lcms ltdl png ps tiff webp zlib
And I just compared to previous version where it is working:

Code: Select all

/app/thirtysec # convert --version
Version: ImageMagick 6.9.3-4 Q16 x86_64 2016-02-17 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2016 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher Modules
Delegates (built-in): fontconfig freetype jng jpeg lcms ltdl png tiff webp zlib
Even weirder, in newest version there are two new delegates: gslib and ps
Rest of delegates are identical.

I even compared "identify -list configure":
Image

Re: Cannot convert images from URL on Alpine Linux Edge

Posted: 2016-06-01T17:52:02-07:00
by fmw42
What is in your policy.xml file? See http://www.imagemagick.org/script/resources.php for potential locations.

Code: Select all

convert -list policy
may tell us something.

Your delegates do include both jpg and png, so that is not the issue. (gslib and ps have to do with reading PDF and PS files, so that is not an issue).

Other than the policy.xml, I do not know what might be different. And in principle, your version of IM should have been before the policy changes and security fixes.

Can you convert local png files (no http)?

Code: Select all

convert logo: logo.png
convert logo.png logo.jpg
Are you on your own computer or server or is it a hosted server? If the latter, did they make any mods to their environment or security?

Re: Cannot convert images from URL on Alpine Linux Edge

Posted: 2016-06-01T20:21:38-07:00
by snibgo
Looking at the source code for v6.9.3-7 and guessing somewhat, I think that to use HTTP: etc you need libxml. XML isn't shown in your delegates, and I can't see it in your "-list configure" (for either version). Your config.log should say whether libxml was found.

Re: Cannot convert images from URL on Alpine Linux Edge

Posted: 2016-06-02T02:32:41-07:00
by darklow
I am testing both versions in docker containers, so they have identical environments, and it works in older (Alpine Linux v3.3 + 6.9.3.4) and doesn't work in newer (Alpine Linux edge + 6.9.4.1).

Converting local PNGs and JPGs work fine, the problem is only with remote images (starting with http or https) of any type.
"convert -list policy" doesn't show anything useful and is identical on both - working and not working versions.

Code: Select all

Path: /etc/ImageMagick-6/policy.xml
  Policy: Unrecognized
    rights: None

Path: [built-in]
  Policy: Undefined
    rights: None
libxml might be the case, however previous version doesn't have libxml in delegates either.
I also found out I am not the only one with this problem, here is bug report about same thing on Alpine issues:
https://bugs.alpinelinux.org/issues/5445

Re: Cannot convert images from URL on Alpine Linux Edge

Posted: 2016-06-02T03:16:17-07:00
by darklow
snibgo looks like you're right and libxml support is missing.
On previous version only "https" is working (if I understood correctly it may use curl for https).
Another question is why HTTPS stopped working on newest.

On edge + ImageMagick 6.9.4.1 (Doesn't work either http nor https)

Code: Select all

$ identify http://imagemagick.org/image/wizard.jpg
identify: unable to open image `//imagemagick.org/image/wizard.jpg': No such file or directory @ error/blob.c/OpenBlob/2702.
identify: no decode delegate for this image format `HTTP' @ error/constitute.c/ReadImage/501.

$ identify https://imagemagick.org/image/wizard.jpg
identify: unable to open image `//imagemagick.org/image/wizard.jpg': No such file or directory @ error/blob.c/OpenBlob/2702.
identify: no decode delegate for this image format `HTTPS' @ error/constitute.c/ReadImage/501.
v3.3 + ImageMagick 6.9.3.4 (works only with https - because curl is used for https)

Code: Select all

$ identify http://imagemagick.org/image/wizard.jpg
identify: unable to open image `//imagemagick.org/image/wizard.jpg': No such file or directory @ error/blob.c/OpenBlob/2702.
identify: no decode delegate for this image format `HTTP' @ error/constitute.c/ReadImage/501.

$ identify https://imagemagick.org/image/wizard.jpg
https://imagemagick.org/image/wizard.jpg=>//imagemagick.org/image/wizard.jpg JPEG 265x352 265x352+0+0 8-bit sRGB 68.3KB 0.000u 0:00.000