Docker: svg support for imagick

Created on 3 Jan 2019  路  12Comments  路  Source: nextcloud/docker

Pull Request #575 has solved adding imagick manually to the container - thank you for this! - but imagick is missing SVG Support.
After changing my custom docker image back to the default (nextcloud:15-fpm-alpine), I am now stuck with the blue default favicons. My custom image showed the current app icon with the themed background.

Since I am new to this docker game, I cannot implement this change myself (I basically copy-pasted my code from the example docker files)

  • What packages can I add manually to enable SVG support in imagick?
  • What changes are needed in the official docker file to add support for SVG?
  • Is SVG support something that should be added for everyone (i.E. official docker file) or should it be optional (i.E. add an example in the documentation) ?

Most helpful comment

You need to add libmagickcore-6.q16-3-extra to your image. This will add support for additional formats, including svg, to imagemagick.

For example change the part in the example where all the apt-get installs happen, to include this package:

RUN set -ex; \
    \
    apt-get update; \
    apt-get install -y --no-install-recommends \
        ffmpeg \
        smbclient \
        supervisor \
        # svg support
        libmagickcore-6.q16-3-extra \
    ; \
    rm -rf /var/lib/apt/lists/*

All 12 comments

You need to add libmagickcore-6.q16-3-extra to your image. This will add support for additional formats, including svg, to imagemagick.

For example change the part in the example where all the apt-get installs happen, to include this package:

RUN set -ex; \
    \
    apt-get update; \
    apt-get install -y --no-install-recommends \
        ffmpeg \
        smbclient \
        supervisor \
        # svg support
        libmagickcore-6.q16-3-extra \
    ; \
    rm -rf /var/lib/apt/lists/*

There's an ongoing discussion in https://github.com/nextcloud/server/issues/13099

Do you think we could publish another flavor with svg support and notice the user about the security concerns?

I think this does only affect Debian based images, so I filled #634 for consistency.

Looks like this does actually require the imagemagick binary. I've added this to the full example in #634, but I think it's not worth adding this by default (nextcloud/server#13099). You can easily convert the favicon locally to a PNG.

My point is that if it is "not worth" adding the package by default, why is the pecl extension being installed? As outlined, the extension shows loaded, but with no supported file formats. It used to be that neither the PECL extension or the imagemagick package were included. I have a derived image that I maintain with the added functionality here.

I used to have to add support for imagemagick, until I saw that starting with version 15, both the package and the extension were being included. Not so with 16 tho.

My point is that if it is "not worth" adding the package by default, why is the pecl extension being installed?

pecl extension "imagemagick" is installed by default. svg support for imagemagick is optional and not installed by default.

AFAIK imagick is used to speed up thumbnail generation and the imagemagick binary is used for extended file formats like SVG and PDF.

In nextcloud 17, imagemagick svg support is used to convert various elements like folder icons. the package is missing in the official nextcloud:17-fpm image. The folders and my logo were black after the upgrade to 17.

my workaround:

docker-compose exec nextcloud bash
apt install libmagickcore-6.q16-6-extra
./occ repair # clean frontend caches
docker-compose restart

Thanks, I will try something like this in my fpm-alpine image.

Actually it seems my problem is a little bit different. The SVG "seems" like it is being rendered but it is incorrectly rendered. I have checked the logs and are not able to see any helpful errors that would point to missing libs or the sort.

SVG Logo:
android-chrome-192x192

What it actually renders:
image

You need to add libmagickcore-6.q16-3-extra to your image. This will add support for additional formats, including svg, to imagemagick.

For example change the part in the example where all the apt-get installs happen, to include this package:

RUN set -ex; \
    \
    apt-get update; \
    apt-get install -y --no-install-recommends \
        ffmpeg \
        smbclient \
        supervisor \
        # svg support
        libmagickcore-6.q16-3-extra \
    ; \
    rm -rf /var/lib/apt/lists/*

thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pierreozoux picture pierreozoux  路  3Comments

all-the-good-ones-are-gone picture all-the-good-ones-are-gone  路  3Comments

Xanarkan picture Xanarkan  路  3Comments

waldner picture waldner  路  3Comments

DrMurx picture DrMurx  路  4Comments