繁体   English   中英

如何在R中使用magick保存高分辨率图像?

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

我想使用magick包创建一个 3 x 3 的高分辨率“蒙太奇”。

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

所以我的问题是如何将其保存为高分辨率 png(例如,300 DPI)? 我想使用image_write() ,但显然我无法在那里设置我想要的分辨率。

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

谢谢你,菲尔

reprex 包(v0.2.1) 于 2019 年 5 月 9 日创建

我遇到了同样的问题,但在 magick vignett https://docs.ropensci.org/magick/articles/intro.html#read-and-write 中找到了解决方案

image_write(i, path = "final.png", format = "png")

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM