Sunday, March 21, 2010

AppleScript로 이미지 리사이즈하는 코드 자동생성하기

image file을 resize하거나 rotate 하는 등의 코드는
자동 생성이 되므로 쉽게 짤 수 있다.
set filechosen to choose file
set filename_ to (filechosen as text)
set filename to POSIX path of filename_
까지 입력한 후,

filename 을 선택하고 오른클릭 해서
Image Manipulation > resize
를 선택하면 다음과 같이 코드가 자동 생성된다.
set filechosen to choose file
set filename_ to (filechosen as text)
set filename to POSIX path of filename_

tell application "Image Events"
    set this_image to open filename
    scale this_image to size 400
    save this_image in filename
    close this_image
end tell
다음과 같이 percentage 로 resize 할수도 있다.
scale this_image by factor 0.3

No comments:

Post a Comment