Skip to content

Commit

Permalink
refactor: Use 'system2()' and suppress 'convert' error messages
Browse files Browse the repository at this point in the history
* Use 'system2()' and suppress 'convert' error messages
 in internal `fill_area_with_img_tile()`
  • Loading branch information
trevorld committed Feb 15, 2022
1 parent e659ee7 commit e644da5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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="[email protected]"),
person("Thomas Lin", "Pedersen", role = "ctb", comment = "new_data_frame() copied from ggplot2"))
Expand Down
9 changes: 6 additions & 3 deletions R/utils-magick-fill.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit e644da5

Please sign in to comment.