【发布时间】:2021-02-23 13:42:18
【问题描述】:
我想使用 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 package (v0.2.1) 于 2019 年 5 月 9 日创建
【问题讨论】:
-
也许只是在写入输出之前设置密度。见rmagick.github.io/imageattrs.html#density
-
我不知道怎么做。我试过
image_read("path", density = 600),但没有运气。同样来自文档:“分辨率渲染 pdf 或 svg”。所以它似乎不适用于光栅图像。 -
密度只控制光栅图像的打印方式。它不会影响光栅图像本身的质量。要获得更高质量的栅格,您需要从更高质量的栅格 png 开始(创建的宽度和高度更大——您不能只是将其调整为更大)。
-
你做到了吗?我希望对
magick包执行相同的操作...
标签: r imagemagick