How to save a high resolution image with magick in R?

孤者浪人 提交于 2021-01-28 14:01:01

问题


I would like to create a high resolution “montage” of 3 by 3 using the magick package.

library(magick)
#> Linking to ImageMagick 6.9.7.4
#> Enabled features: fontconfig, freetype, fftw, lcms, pango, x11
#> Disabled features: cairo, ghostscript, rsvg, webp

# Read the image and resize it
frink <- image_read("https://jeroen.github.io/images/frink.png")
frink <- image_resize(frink, "100x")

# Create 1 column with 3 rows
col <- image_append(rep(frink, 3), stack = TRUE)

# "Combine" 3 columns
i <- image_append(c(col, col, col))

i

So my question is how can I save it to a high-resolution png (e.g., 300 DPI)? I was thinking to use image_write(), but apparently I can not set the resolution I want there.

# This is not working
# image_write(i, tempfile(), res = 300)

Thank you, Phil

Created on 2019-05-09 by the reprex package (v0.2.1)

来源:https://stackoverflow.com/questions/56060625/how-to-save-a-high-resolution-image-with-magick-in-r

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!