readthedocs / readthedocs-docker-images

Docker image definitions used by Read the Docs
115 stars 70 forks source link

Compile ImageMagick with the RSVG delegate enabled #131

Closed Daltz333 closed 4 months ago

Daltz333 commented 4 years ago

ImageMagick installed with Ubuntu/Debian does not include RSVG enabled by default. RSVG has to be enabled by compiling ImageMagick with --with-rsvg=yes with all of the various delegates configured and installed.

(Seriously ImageMagick, why do you not have RSVG enabled...)

We are using fairly complex SVGs. Attached is one example (Download and change XML to SVG) https://hastebin.com/tavolodupe.xml

When compiling on RTD, we get a broken output such as black images. This is reproduced on my Ubuntu machine but running magick convert on my Windows machine gives the correct output.

I'm in the process of creating a script to automate the installation of all the various delegates and ImageMagick, but this isn't feasible to deploy on RTD.

Daltz333 commented 4 years ago

I created the following script to configure and install everything for me. https://gist.github.com/Daltz333/3d0d4d04f45fd47604a98b60c2bf15b9

Daltz333 commented 4 years ago

Okay, an easier solution is to install Inkscape as ImageMagick will use that if installed.

humitos commented 4 years ago

I'm not too familiarized with this problem.

Okay, an easier solution is to install Inkscape as ImageMagick will use that if installed.

Do you have any resource that I can read about this?

I'm not opposite to add this package, but "being used automatically" means that it will affect all the users, and I'm not sure that won't produce unexpected output for them.

Daltz333 commented 4 years ago

ImageMagick6 for Ubuntu does not include RSVG delegate, and the internal SVG delegate seems to give poor accuracy for any SVG I give it.

image

Daltz333 commented 4 years ago

Would it be possible for this package to exist on a per build/project basis?

amotl commented 3 years ago

Hi there,

we are also observing similar things with ImageMagick (6.9.7-4 croaks while 7.0.10-29 apparently works), so I believe it would be a good idea to share our findings at https://github.com/earthobservations/wetterdienst/issues/155#issuecomment-692975055 with you.

While we will move on with sphinxcontrib-svg2pdfconverter as outlined at https://github.com/earthobservations/wetterdienst/issues/155#issuecomment-692987548, updating the ImageMagick installation will nevertheless make sense.

Most probably, some things will resolve after merging https://github.com/readthedocs/readthedocs-docker-images/pull/137.

With kind regards, Andreas.

Edit: We had no luck even after moving on to sphinxcontrib.rsvgconverter, see https://github.com/earthobservations/wetterdienst/issues/155#issuecomment-693003268.

humitos commented 3 years ago

Most probably, some things will resolve after merging #137.

@amotl I'm targeting deploying that PR under a testing docker image next week. I'll write a comment here if everything goes smooth asking you for test the new docker image with Ubuntu 20.04 LTS.

njzjz commented 4 months ago

Okay, an easier solution is to install Inkscape as ImageMagick will use that if installed.

It seems that this issue still exists in 2024. To install Inkscape, one can add inkscape to build.apt_packages:

build:
  apt_packages:
    - inkscape
humitos commented 4 months ago

We don't plan to modify the Docker images we use to build the documentation. Since there is a solution already proposed here by installing Inkscape at build time, I'll proceed to close this issue as not planned.