||
1. #### Install ImageMagick https://www.imagemagick.org/script/index.php
安装 ImageMagick
2. #### Make sure the command mogrify could be called from CMD
安装时选择添加路径,以便mogrify组建能够从CMD调用。
#### Run the following R code
运行以下R代码。location为照片所保存的文件夹。
location ="D:/photos"
setwd(location)
dirs <- list.dirs(path = location, full.names =TRUE, recursive =TRUE)
for(i in 1:length(dirs)){
temp <- dirs[i]
setwd(temp)
system("mogrify -resize 2909x4000 -density 72 *.jpg")
print(paste("Resizing",temp))
}
##### 更多选项参见 mogrify的帮助。
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-12-27 09:47
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社