我正在尝试将pdf图转换为png或jpeg文件.原因是我想使用图像进行演示,我需要两种格式,具有完全相同的尺寸/缩放.
我在动画包中尝试了函数im.convert(),但输出看起来非常糟糕,包括png和jpeg.
为了能够运行以下代码,您需要"动画"包和ImageMagick软件(http://www.imagemagick.org/script/convert.php)
library("animation")
ani.options(outdir = getwd())
pdf("bm.pdf")
plot(1:10)
dev.off()
im.convert("bm.pdf", output = "bm.jpeg")
im.convert("bm.pdf", output = "bm.png")
Run Code Online (Sandbox Code Playgroud)