我需要一个简单和免费的方式来调整图像大小和做批处理,如果必要的话。自由图像处理软件的使用比它应该使用的要复杂得多。
发布于 2015-02-12 23:22:26
正如LifeHacker所指出的,下面的命令将非常容易地做到这一点:
sips -Z 640 *.jpg引用他们的解释:
"sips是正在使用的命令,-Z告诉它保持图像的纵横比。"640“是要使用的最大高度和宽度,"*.jpg”指示计算机缩小以.jpg结尾的每幅图像的大小。它非常简单,而且缩小图像的速度非常快。如果您想要保留它们更大的大小,请务必先复制它们。“
来源:http://lifehacker.com/5962420/batch-resize-images-quickly-in-the-os-x-terminal
发布于 2015-02-12 23:33:42
影象帮助:
$ convert foo.jpg -resize 50% bar.jpg它可以做更多的事情,包括格式之间的转换、应用效果、裁剪、着色等等。
发布于 2015-12-22 18:53:19
下面是使用sips递归调整给定文件夹(及其子文件夹)中所有图像大小的脚本,并将调整大小的图像放在与图像相同的树级上:https://gist.github.com/lopespm/893f323a04fcc59466d7。
#!/bin/bash
# This script resizes all the images it finds in a folder (and its subfolders) and resizes them
# The resized image is placed in the /resized folder which will reside in the same directory as the image
#
# Usage: > ./batch_resize.sh
initial_folder="/your/images/folder" # You can use "." to target the folder in which you are running the script for example
resized_folder_name="resized"
all_images=$(find -E $initial_folder -iregex ".*\.(jpg|gif|png|jpeg)")
while read -r image_full_path; do
filename=$(basename "$image_full_path");
source_folder=$(dirname "$image_full_path");
destination_folder=$source_folder"/"$resized_folder_name"/";
destination_full_path=$destination_folder$filename;
if [ ! -z "$image_full_path" -a "$image_full_path" != " " ] &&
# Do not resize images inside a folder that was already resized
[ "$(basename "$source_folder")" != "$resized_folder_name" ]; then
mkdir "$destination_folder";
sips -Z 700 "$image_full_path" --out "$destination_full_path";
fi
done <<< "$all_images"https://stackoverflow.com/questions/28489793
复制相似问题