r magick`image_annotate()
当尝试使用image_annotate()
函数从magick
package添加到图像中时,我现在会出现一个错误,抱怨noncode> noncodeffrawingDrawingDrawingPrimitivedEftinitiveNitiveDinitive text < /代码>。
我已经运行brew install install ghostscript
和brew install intern imagemagick
,这两者都报告了当前版本。可能导致此错误是什么?
library(magick)
#> Linking to ImageMagick 6.9.12.3
#> Enabled features: cairo, fontconfig, freetype, heic, lcms, pango, raw, rsvg, webp
#> Disabled features: fftw, ghostscript, x11
# Load a test image
frink <- image_read("https://jeroen.github.io/images/frink.png")
# Attempt to annotate with some text
image_annotate(frink, "frink")
#> Error in magick_image_annotate(image, text, gravity, location, degrees, : R: NonconformingDrawingPrimitiveDefinition `text' @ error/draw.c/RenderMVGContent/4405
# magick package configuration
str(magick_config())
#> List of 24
#> $ version :Class 'numeric_version' hidden list of 1
#> ..$ : int [1:4] 6 9 12 3
#> $ modules : logi FALSE
#> $ cairo : logi TRUE
#> $ fontconfig : logi TRUE
#> $ freetype : logi TRUE
#> $ fftw : logi FALSE
#> $ ghostscript : logi FALSE
#> $ heic : logi TRUE
#> $ jpeg : logi TRUE
#> $ lcms : logi TRUE
#> $ libopenjp2 : logi TRUE
#> $ lzma : logi TRUE
#> $ pangocairo : logi TRUE
#> $ pango : logi TRUE
#> $ png : logi TRUE
#> $ raw : logi TRUE
#> $ rsvg : logi TRUE
#> $ tiff : logi TRUE
#> $ webp : logi TRUE
#> $ wmf : logi FALSE
#> $ x11 : logi FALSE
#> $ xml : logi TRUE
#> $ zero-configuration: logi TRUE
#> $ threads : int 1
由
Session infosessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 4.1.2 (2021-11-01)
#> os macOS Monterey 12.3
#> system aarch64, darwin20
#> ui X11
#> language (EN)
#> collate en_GB.UTF-8
#> ctype en_GB.UTF-8
#> tz Europe/London
#> date 2022-04-18
#> pandoc 2.14.0.3 @ /Applications/RStudio.app/Contents/MacOS/pandoc/ (via rmarkdown)
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> package * version date (UTC) lib source
#> cli 3.2.0 2022-02-14 [1] CRAN (R 4.1.1)
#> crayon 1.5.1 2022-03-26 [1] CRAN (R 4.1.1)
#> curl 4.3.2 2021-06-23 [1] CRAN (R 4.1.0)
#> digest 0.6.29 2021-12-01 [1] CRAN (R 4.1.1)
#> ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.1.0)
#> evaluate 0.15 2022-02-18 [1] CRAN (R 4.1.1)
#> fansi 1.0.3 2022-03-24 [1] CRAN (R 4.1.1)
#> fastmap 1.1.0 2021-01-25 [1] CRAN (R 4.1.0)
#> fs 1.5.2 2021-12-08 [1] CRAN (R 4.1.1)
#> glue 1.6.2 2022-02-24 [1] CRAN (R 4.1.1)
#> highr 0.9 2021-04-16 [1] CRAN (R 4.1.0)
#> htmltools 0.5.2 2021-08-25 [1] CRAN (R 4.1.1)
#> knitr 1.38 2022-03-25 [1] CRAN (R 4.1.1)
#> lifecycle 1.0.1 2021-09-24 [1] CRAN (R 4.1.1)
#> magick * 2.7.3 2021-08-18 [1] CRAN (R 4.1.1)
#> magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.1.1)
#> pillar 1.7.0 2022-02-01 [1] CRAN (R 4.1.1)
#> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.1.0)
#> purrr 0.3.4 2020-04-17 [1] CRAN (R 4.1.0)
#> R.cache 0.15.0 2021-04-30 [1] CRAN (R 4.1.0)
#> R.methodsS3 1.8.1 2020-08-26 [1] CRAN (R 4.1.0)
#> R.oo 1.24.0 2020-08-26 [1] CRAN (R 4.1.0)
#> R.utils 2.11.0 2021-09-26 [1] CRAN (R 4.1.1)
#> Rcpp 1.0.8.3 2022-03-17 [1] CRAN (R 4.1.1)
#> reprex 2.0.1 2021-08-05 [1] CRAN (R 4.1.1)
#> rlang 1.0.2 2022-03-04 [1] CRAN (R 4.1.1)
#> rmarkdown 2.13 2022-03-10 [1] CRAN (R 4.1.1)
#> rstudioapi 0.13 2020-11-12 [1] CRAN (R 4.1.0)
#> sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.1.1)
#> stringi 1.7.6 2021-11-29 [1] CRAN (R 4.1.1)
#> stringr 1.4.0 2019-02-10 [1] CRAN (R 4.1.0)
#> styler 1.7.0 2022-03-13 [1] CRAN (R 4.1.1)
#> tibble 3.1.6 2021-11-07 [1] CRAN (R 4.1.1)
#> utf8 1.2.2 2021-07-24 [1] CRAN (R 4.1.0)
#> vctrs 0.4.1 2022-04-13 [1] CRAN (R 4.1.1)
#> withr 2.5.0 2022-03-03 [1] CRAN (R 4.1.1)
#> xfun 0.30 2022-03-02 [1] CRAN (R 4.1.1)
#> yaml 2.3.5 2022-02-21 [1] CRAN (R 4.1.1)
#>
#> [1] /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library
#>
#> ──────────────────────────────────────────────────────────────────────────────
When trying to add text to an image with the image_annotate()
function from the magick
package in R on macOS, I now get an error complaining of NonconformingDrawingPrimitiveDefinition text
.
I have run brew install ghostscript
and brew install imagemagick
, both of which report the current versions are installed. What might be causing this error?
library(magick)
#> Linking to ImageMagick 6.9.12.3
#> Enabled features: cairo, fontconfig, freetype, heic, lcms, pango, raw, rsvg, webp
#> Disabled features: fftw, ghostscript, x11
# Load a test image
frink <- image_read("https://jeroen.github.io/images/frink.png")
# Attempt to annotate with some text
image_annotate(frink, "frink")
#> Error in magick_image_annotate(image, text, gravity, location, degrees, : R: NonconformingDrawingPrimitiveDefinition `text' @ error/draw.c/RenderMVGContent/4405
# magick package configuration
str(magick_config())
#> List of 24
#> $ version :Class 'numeric_version' hidden list of 1
#> ..$ : int [1:4] 6 9 12 3
#> $ modules : logi FALSE
#> $ cairo : logi TRUE
#> $ fontconfig : logi TRUE
#> $ freetype : logi TRUE
#> $ fftw : logi FALSE
#> $ ghostscript : logi FALSE
#> $ heic : logi TRUE
#> $ jpeg : logi TRUE
#> $ lcms : logi TRUE
#> $ libopenjp2 : logi TRUE
#> $ lzma : logi TRUE
#> $ pangocairo : logi TRUE
#> $ pango : logi TRUE
#> $ png : logi TRUE
#> $ raw : logi TRUE
#> $ rsvg : logi TRUE
#> $ tiff : logi TRUE
#> $ webp : logi TRUE
#> $ wmf : logi FALSE
#> $ x11 : logi FALSE
#> $ xml : logi TRUE
#> $ zero-configuration: logi TRUE
#> $ threads : int 1
Created on 2022-04-18 by the reprex package (v2.0.1)
Session info
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 4.1.2 (2021-11-01)
#> os macOS Monterey 12.3
#> system aarch64, darwin20
#> ui X11
#> language (EN)
#> collate en_GB.UTF-8
#> ctype en_GB.UTF-8
#> tz Europe/London
#> date 2022-04-18
#> pandoc 2.14.0.3 @ /Applications/RStudio.app/Contents/MacOS/pandoc/ (via rmarkdown)
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> package * version date (UTC) lib source
#> cli 3.2.0 2022-02-14 [1] CRAN (R 4.1.1)
#> crayon 1.5.1 2022-03-26 [1] CRAN (R 4.1.1)
#> curl 4.3.2 2021-06-23 [1] CRAN (R 4.1.0)
#> digest 0.6.29 2021-12-01 [1] CRAN (R 4.1.1)
#> ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.1.0)
#> evaluate 0.15 2022-02-18 [1] CRAN (R 4.1.1)
#> fansi 1.0.3 2022-03-24 [1] CRAN (R 4.1.1)
#> fastmap 1.1.0 2021-01-25 [1] CRAN (R 4.1.0)
#> fs 1.5.2 2021-12-08 [1] CRAN (R 4.1.1)
#> glue 1.6.2 2022-02-24 [1] CRAN (R 4.1.1)
#> highr 0.9 2021-04-16 [1] CRAN (R 4.1.0)
#> htmltools 0.5.2 2021-08-25 [1] CRAN (R 4.1.1)
#> knitr 1.38 2022-03-25 [1] CRAN (R 4.1.1)
#> lifecycle 1.0.1 2021-09-24 [1] CRAN (R 4.1.1)
#> magick * 2.7.3 2021-08-18 [1] CRAN (R 4.1.1)
#> magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.1.1)
#> pillar 1.7.0 2022-02-01 [1] CRAN (R 4.1.1)
#> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.1.0)
#> purrr 0.3.4 2020-04-17 [1] CRAN (R 4.1.0)
#> R.cache 0.15.0 2021-04-30 [1] CRAN (R 4.1.0)
#> R.methodsS3 1.8.1 2020-08-26 [1] CRAN (R 4.1.0)
#> R.oo 1.24.0 2020-08-26 [1] CRAN (R 4.1.0)
#> R.utils 2.11.0 2021-09-26 [1] CRAN (R 4.1.1)
#> Rcpp 1.0.8.3 2022-03-17 [1] CRAN (R 4.1.1)
#> reprex 2.0.1 2021-08-05 [1] CRAN (R 4.1.1)
#> rlang 1.0.2 2022-03-04 [1] CRAN (R 4.1.1)
#> rmarkdown 2.13 2022-03-10 [1] CRAN (R 4.1.1)
#> rstudioapi 0.13 2020-11-12 [1] CRAN (R 4.1.0)
#> sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.1.1)
#> stringi 1.7.6 2021-11-29 [1] CRAN (R 4.1.1)
#> stringr 1.4.0 2019-02-10 [1] CRAN (R 4.1.0)
#> styler 1.7.0 2022-03-13 [1] CRAN (R 4.1.1)
#> tibble 3.1.6 2021-11-07 [1] CRAN (R 4.1.1)
#> utf8 1.2.2 2021-07-24 [1] CRAN (R 4.1.0)
#> vctrs 0.4.1 2022-04-13 [1] CRAN (R 4.1.1)
#> withr 2.5.0 2022-03-03 [1] CRAN (R 4.1.1)
#> xfun 0.30 2022-03-02 [1] CRAN (R 4.1.1)
#> yaml 2.3.5 2022-02-21 [1] CRAN (R 4.1.1)
#>
#> [1] /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library
#>
#> ──────────────────────────────────────────────────────────────────────────────
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在github包上打开了有关此问题的问题,因为我遇到了同样的错误。包裹作者建议安装Xquartz,这为我解决了。
I opened an issue about this on the package GitHub because I was getting the same error. The package author suggested installing xQuartz, and that solved it for me.