From e644da5403c38d756278d738f7700783d05f2edd Mon Sep 17 00:00:00 2001 From: Trevor L Davis Date: Mon, 14 Feb 2022 17:25:29 -0800 Subject: [PATCH] refactor: Use 'system2()' and suppress 'convert' error messages * Use 'system2()' and suppress 'convert' error messages in internal `fill_area_with_img_tile()` --- DESCRIPTION | 2 +- R/utils-magick-fill.R | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 7a7cda7..a33bc9c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: gridpattern Type: Package Title: 'grid' Pattern Grobs -Version: 0.5.0-9 +Version: 0.5.0-10 Authors@R: c(person("Mike", "FC", role = "aut", comment = "Code/docs adapted from ggpattern"), person("Trevor L", "Davis", role=c("aut", "cre"), email="trevor.l.davis@gmail.com"), person("Thomas Lin", "Pedersen", role = "ctb", comment = "new_data_frame() copied from ggplot2")) diff --git a/R/utils-magick-fill.R b/R/utils-magick-fill.R index 67723b1..157f7a2 100644 --- a/R/utils-magick-fill.R +++ b/R/utils-magick-fill.R @@ -189,9 +189,12 @@ fill_area_with_img_tile <- function(img, width, height, filter = filter, scale = # requires `convert` command-line tool which tends to choke on Windows tile_image_via_convert <- function(tile_temp_filename, width, height) { tmp_filename <- tempfile(fileext = ".png") - command <- glue("convert -size {width}x{height} tile:'{tile_temp_filename}' ", - "-background none {tmp_filename}") - system(command) + command <- "convert" + args <- c("-size", glue("{width}x{height}"), + glue("tile:'{tile_temp_filename}'"), + "-background", "none", + tmp_filename) + system2(command, args, stdout = FALSE, stderr = FALSE) magick::image_read(tmp_filename) }