Disable image_info() while using `magick::image_read()`

Hi,

While reading in images in R using magick::image_read(), I am only interested in the image displayed in the Viewer pane and not the image information displayed in the console. How can I disable the latter?

1 Like

:wave: @Shel and welcome on this forum!

All magick functions return magick-image objects. The information printed by image_scale() can’t be turned off. But there is a possible workaround! (thanks @jeroenooms)

library("magick")
#> Linking to ImageMagick 6.9.10.23
#> Enabled features: fontconfig, freetype, fftw, lcms, pango, webp, x11
#> Disabled features: cairo, ghostscript, heic, raw, rsvg
#> Using 8 threads
logo <- image_read("logo:")
logo <- image_scale(logo, "400")
print(logo, info = FALSE)

logo

# or with the pipe
image_read("logo:") |>
  image_scale("400") |>
  print(info = FALSE)

logo

Created on 2021-10-22 by the reprex package (v2.0.0)

I hope this helps!

Oh wow!! That was very fast … and it works. Thank you

1 Like