From 0e09f950dd88256ff469bc343c01ec922ccf5385 Mon Sep 17 00:00:00 2001 From: Sam Perman Date: Mon, 12 Apr 2021 13:31:10 -0400 Subject: [PATCH] Enable image magick ghostscript features See https://www.kb.cert.org/vuls/id/332928/ Enable features on focal since ghostscript is new enough Fixes #286 --- CONTRIBUTING.md | 2 +- packages/magick/install | 9 +++++++++ packages/magick/test.R | 8 ++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 643eafe..f2a61dc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -52,5 +52,5 @@ touch packages/[r_package_name]/test.R ```bash make test-xenial-[r_package_name] -make test-bionic-[r_package_name] +make test-focal-[r_package_name] ``` diff --git a/packages/magick/install b/packages/magick/install index 447a46c..3b1cc53 100755 --- a/packages/magick/install +++ b/packages/magick/install @@ -16,3 +16,12 @@ if [ ${OS_CODENAME} == "xenial" ]; then fi apt-get install -y libmagick++-dev + + +if [ ${OS_CODENAME} == "focal" ]; then + # Enable imagemagick ghostscript features + # See https://www.kb.cert.org/vuls/id/332928/ + # focal has a new enough version of ghostscript + sed -i "\$i \ \ " /etc/ImageMagick-6/policy.xml +fi + diff --git a/packages/magick/test.R b/packages/magick/test.R index 9d4c569..23823f0 100644 --- a/packages/magick/test.R +++ b/packages/magick/test.R @@ -5,3 +5,11 @@ install.packages("magick", repos = "https://cran.rstudio.com") library(magick) docdir <- Sys.getenv("R_DOC_DIR", R.home("doc")) img <- magick::image_read(file.path(docdir, "html", "logo.jpg")) + +# Create a pdf +image_write(wizard, + tempfile(pattern = "pdftemp", fileext = '.pdf'), + density = 55, + format = 'pdf', + comment = "Edit PDFs and Images" +)