Mac OSX에서 터미널을 사용하여 이미지 크기를 조정하는 방법은 무엇입니까?
Mac OSX에서 터미널을 사용하여 이미지 크기를 조정하는 방법은 무엇입니까?
필요한 경우 이미지 크기를 조정하고 일괄 작업을 수행하는 간단하고 자유로운 방법이 필요합니다. 무료 이미지 조작 소프트웨어는 사용해야하는 것보다 사용하기가 더 까다 롭습니다.
LifeHacker가 지적했듯이 다음 명령은이 작업을 매우 쉽게 수행합니다.
sips -Z 640 *.jpg
설명을 인용하려면 :
"그래서 무슨 일이 일어나고 있습니까?"sips "는 사용되는 명령이고 -Z는 이미지의 종횡비를 유지하도록 지시합니다."640 "은 사용할 최대 높이와 너비이고"* .jpg "는 컴퓨터의 크기를 줄 이도록 지시합니다. .jpg로 끝나는 모든 이미지. 매우 간단하고 이미지를 매우 빠르게 축소합니다. 더 큰 크기도 유지하려면 먼저 사본을 만드십시오. "
출처 : http://lifehacker.com/5962420/batch-resize-images-quickly-in-the-os-x-terminal
imagemagick 은 다음을 지원합니다.
$ convert foo.jpg -resize 50% bar.jpg
형식 간 변환, 효과 적용, 자르기, 색상 화 등 더 많은 작업을 수행 할 수 있습니다.
다음은 sips
주어진 폴더 (및 하위 폴더)의 모든 이미지 크기를 재귀 적으로 조정하고 크기 조정 된 이미지를 이미지 resized
와 동일한 트리 수준 의 폴더에 배치 하는 데 사용 하는 스크립트입니다 : 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"
이전 답변이 정확합니다. mogrify도 사용할 수 있습니다. 예를 들어, 디렉토리에있는 많은 이미지의 크기를 60 % 줄이려면 아래 명령을 사용할 수 있습니다.
물론이 명령을 실행하기 전에 항상 이미지를 다른 디렉토리에 백업하십시오.
mogrify -resize 60% *
itunesconnect에 대한 마술 :)
mkdir ./iPhone5-5-Portrait
sips -z 2208 1242 *.jpg -s formatOptions 70 --out ./iPhone5-5-Portrait
sips -z 2208 1242 *.png --out ./iPhone5-5-Portrait
ReferenceURL : https://stackoverflow.com/questions/28489793/how-to-resize-images-using-terminal-on-mac-osx