myResizeImage(200, 100)
on myResizeImage(newWidth, newHeight)
tell application "Adobe Photoshop CS4"end myResizeImage
set myDoc to current documentend tell
set oldUnits to ruler units of settings
set ruler units of settings to pixel units
tell myDoc
set {w, h} to {width, height}end tell
resize image myDoc width newWidth height newHeight resample method bicubic sharper
set ruler units of settings to oldUnits
다음은 레퍼런스에 있던 원래 코드. 잘 안된다고 함.
-- ========================레퍼런스 :
-- Create and save the 20 Mb file
-- ========================
tell application "Adobe Photoshop CS2"
set doc20 to current documentend tell
-- Resize to 20 Mb
set oldUnits to ruler units of settings
set ruler units of settings to pixel units
tell doc20
set {w, h} to {width, height}end tell
-- newWidth is calculated based on the following formulas
-- 20Mb = ( 3 * (prct*w) * (prct*h) ) / 1024^2
-- newWidth = prct * w
set newWidth to ((20971520 / (w * h * 3)) ^ 0.5) * w
resize image doc20 width newWidth resolution 300 resample method bicubic sharper -- Works up to here
set ruler units of settings to inch units
resize image doc20 width oldWidth resample method none -- Errors on this line
set ruler units of settings to oldUnits
Resize Image in Photoshop
No comments:
Post a Comment