Closed mvankessel-EMC closed 1 year ago
Hmm thats weird. Can you try with image_read_svg()
Thanks for the quick response, this results in the following error:
#> Error in path.expand(path): invalid 'path' argument
# install.packages(c("DiagrammeR", "DiagrammeRsvg", "magick"))
diagram <- "
digraph {
graph [layout = dot, rankdir = LR]
A -> B
B -> C
B -> D
}
"
diagram |>
DiagrammeR::grViz() |>
DiagrammeRsvg::export_svg() |>
charToRaw() |>
magick::image_read_svg()
#> Error in path.expand(path): invalid 'path' argument
Created on 2023-08-11 with reprex v2.0.2
bitmap <- diagram |>
DiagrammeR::grViz() |>
DiagrammeRsvg::export_svg() |>
charToRaw()
class(bitmap)
#> [1] "raw"
It works (without the charToRaw) on MacOS:
diagram |>
DiagrammeR::grViz() |>
DiagrammeRsvg::export_svg() |>
magick::image_read_svg()
It works on Windows too, thank you.
# install.packages(c("DiagrammeR", "DiagrammeRsvg", "magick"))
diagram <- "
digraph {
graph [layout = dot, rankdir = LR]
A -> B
B -> C
B -> D
}
"
diagram |>
DiagrammeR::grViz() |>
DiagrammeRsvg::export_svg() |>
magick::image_read_svg()
Created on 2023-08-11 with reprex v2.0.2
Although I'm still a little confused as to why the update to libmagick 6.9.12-93 breaks the use of magick::image_read()
in this case.
Although I'm still a little confused as to why the update to libmagick 6.9.12-93 breaks the use of magick::image_read() in this case.
Yes me too, I'm opening a new issue about this: https://github.com/ropensci/magick/issues/380
While using
magick::image_read()
I'm encountering the following error using the latest CRAN release, version 2.7.5:However the same code using version 2.7.3 seems to work fine. See the Reprex for both versions below.
Reprex version 2.7.5
Created on 2023-08-11 with reprex v2.0.2
Session info
``` r sessioninfo::session_info() #> ─ Session info ─────────────────────────────────────────────────────────────── #> setting value #> version R version 4.3.1 (2023-06-16 ucrt) #> os Windows 11 x64 (build 22621) #> system x86_64, mingw32 #> ui RTerm #> language (EN) #> collate Dutch_Netherlands.utf8 #> ctype Dutch_Netherlands.utf8 #> tz Europe/Amsterdam #> date 2023-08-11 #> pandoc 3.1.1 @ C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/ (via rmarkdown) #> #> ─ Packages ─────────────────────────────────────────────────────────────────── #> package * version date (UTC) lib source #> cli 3.6.1 2023-03-23 [1] CRAN (R 4.3.1) #> curl 5.0.1 2023-06-07 [1] CRAN (R 4.3.1) #> DiagrammeR 1.0.10 2023-05-18 [1] CRAN (R 4.3.1) #> DiagrammeRsvg 0.1 2016-02-04 [1] CRAN (R 4.3.1) #> digest 0.6.33 2023-07-07 [1] CRAN (R 4.3.1) #> evaluate 0.21 2023-05-05 [1] CRAN (R 4.3.1) #> fastmap 1.1.1 2023-02-24 [1] CRAN (R 4.3.1) #> fs 1.6.3 2023-07-20 [1] CRAN (R 4.3.1) #> glue 1.6.2 2022-02-24 [1] CRAN (R 4.3.1) #> htmltools 0.5.5 2023-03-23 [1] CRAN (R 4.3.1) #> htmlwidgets 1.6.2 2023-03-17 [1] CRAN (R 4.3.1) #> jsonlite 1.8.7 2023-06-29 [1] CRAN (R 4.3.1) #> knitr 1.43 2023-05-25 [1] RSPM (R 4.3.0) #> lifecycle 1.0.3 2022-10-07 [1] CRAN (R 4.3.1) #> magick 2.7.5 2023-08-07 [1] CRAN (R 4.3.1) #> magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.3.1) #> purrr 1.0.1 2023-01-10 [1] CRAN (R 4.3.1) #> R.cache 0.16.0 2022-07-21 [1] CRAN (R 4.3.1) #> R.methodsS3 1.8.2 2022-06-13 [1] CRAN (R 4.3.0) #> R.oo 1.25.0 2022-06-12 [1] CRAN (R 4.3.0) #> R.utils 2.12.2 2022-11-11 [1] CRAN (R 4.3.1) #> RColorBrewer 1.1-3 2022-04-03 [1] CRAN (R 4.3.0) #> Rcpp 1.0.11 2023-07-06 [1] CRAN (R 4.3.1) #> reprex 2.0.2 2022-08-17 [1] CRAN (R 4.3.1) #> rlang 1.1.1 2023-04-28 [1] CRAN (R 4.3.1) #> rmarkdown 2.23 2023-07-01 [1] CRAN (R 4.3.1) #> rstudioapi 0.15.0 2023-07-07 [1] CRAN (R 4.3.1) #> sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.3.1) #> styler 1.10.1 2023-06-05 [1] CRAN (R 4.3.1) #> V8 4.3.3 2023-07-18 [1] CRAN (R 4.3.1) #> vctrs 0.6.3 2023-06-14 [1] CRAN (R 4.3.1) #> visNetwork 2.1.2 2022-09-29 [1] CRAN (R 4.3.1) #> withr 2.5.0 2022-03-03 [1] CRAN (R 4.3.1) #> xfun 0.39 2023-04-20 [1] CRAN (R 4.3.1) #> yaml 2.3.7 2023-01-23 [1] CRAN (R 4.3.0) #> #> [1] C:/R/R-4.3.1/library #> #> ────────────────────────────────────────────────────────────────────────────── ```Reprex version 2.7.3
Created on 2023-08-11 with reprex v2.0.2
Session info
``` r sessioninfo::session_info() #> ─ Session info ─────────────────────────────────────────────────────────────── #> setting value #> version R version 4.3.1 (2023-06-16 ucrt) #> os Windows 11 x64 (build 22621) #> system x86_64, mingw32 #> ui RTerm #> language (EN) #> collate Dutch_Netherlands.utf8 #> ctype Dutch_Netherlands.utf8 #> tz Europe/Amsterdam #> date 2023-08-11 #> pandoc 3.1.1 @ C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/ (via rmarkdown) #> #> ─ Packages ─────────────────────────────────────────────────────────────────── #> package * version date (UTC) lib source #> cli 3.6.1 2023-03-23 [1] CRAN (R 4.3.1) #> curl 5.0.1 2023-06-07 [1] CRAN (R 4.3.1) #> DiagrammeR 1.0.10 2023-05-18 [1] CRAN (R 4.3.1) #> DiagrammeRsvg 0.1 2016-02-04 [1] CRAN (R 4.3.1) #> digest 0.6.33 2023-07-07 [1] CRAN (R 4.3.1) #> evaluate 0.21 2023-05-05 [1] CRAN (R 4.3.1) #> fastmap 1.1.1 2023-02-24 [1] CRAN (R 4.3.1) #> fs 1.6.3 2023-07-20 [1] CRAN (R 4.3.1) #> glue 1.6.2 2022-02-24 [1] CRAN (R 4.3.1) #> highr 0.10 2022-12-22 [1] CRAN (R 4.3.1) #> htmltools 0.5.5 2023-03-23 [1] CRAN (R 4.3.1) #> htmlwidgets 1.6.2 2023-03-17 [1] CRAN (R 4.3.1) #> jsonlite 1.8.7 2023-06-29 [1] CRAN (R 4.3.1) #> knitr 1.43 2023-05-25 [1] RSPM (R 4.3.0) #> lifecycle 1.0.3 2022-10-07 [1] CRAN (R 4.3.1) #> magick 2.7.3 2021-08-18 [1] CRAN (R 4.3.1) #> magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.3.1) #> png 0.1-8 2022-11-29 [1] CRAN (R 4.3.0) #> purrr 1.0.1 2023-01-10 [1] CRAN (R 4.3.1) #> R.cache 0.16.0 2022-07-21 [1] CRAN (R 4.3.1) #> R.methodsS3 1.8.2 2022-06-13 [1] CRAN (R 4.3.0) #> R.oo 1.25.0 2022-06-12 [1] CRAN (R 4.3.0) #> R.utils 2.12.2 2022-11-11 [1] CRAN (R 4.3.1) #> RColorBrewer 1.1-3 2022-04-03 [1] CRAN (R 4.3.0) #> Rcpp 1.0.11 2023-07-06 [1] CRAN (R 4.3.1) #> reprex 2.0.2 2022-08-17 [1] CRAN (R 4.3.1) #> rlang 1.1.1 2023-04-28 [1] CRAN (R 4.3.1) #> rmarkdown 2.23 2023-07-01 [1] CRAN (R 4.3.1) #> rstudioapi 0.15.0 2023-07-07 [1] CRAN (R 4.3.1) #> sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.3.1) #> styler 1.10.1 2023-06-05 [1] CRAN (R 4.3.1) #> V8 4.3.3 2023-07-18 [1] CRAN (R 4.3.1) #> vctrs 0.6.3 2023-06-14 [1] CRAN (R 4.3.1) #> visNetwork 2.1.2 2022-09-29 [1] CRAN (R 4.3.1) #> withr 2.5.0 2022-03-03 [1] CRAN (R 4.3.1) #> xfun 0.39 2023-04-20 [1] CRAN (R 4.3.1) #> xml2 1.3.5 2023-07-06 [1] CRAN (R 4.3.1) #> yaml 2.3.7 2023-01-23 [1] CRAN (R 4.3.0) #> #> [1] C:/R/R-4.3.1/library #> #> ────────────────────────────────────────────────────────────────────────────── ```