我想按大小对图片进行排序,按宽度最简单。我想获取宽度大于 1919px 的图像并将其放在另一个文件夹中。我已经用谷歌搜索并尝试了几个小时,但没有运气。
我一直收到这个错误:error "Image Events got an error: Can’t make item 1 of dimensions of image \"1mouwi.jpg\" into type specifier." number -1700 from item 1 of dimensions of image "1mouwi.jpg" to specifier
在item 1
重复循环中。有关如何解决此问题的任何帮助?
我的代码:
set picFolder to alias ":Users:USERNAME:Pictures:DESKTOPS:"
set hdFolder to alias ":Users:USERNAME:Pictures:DESKTOPS_HD:"
tell application "System Events"
set photos1 to path of files of picFolder
set num to count of photos1
set photos to items 2 thru num of photos1
end tell
set hd to {}
repeat with imgPath in photos
set imgAlias to alias imgPath
tell application "Image Events"
set img to open imgPath
set width to item 1 of dimensions of img
if width > 1919.0 then
set end of hd to imgAlias
end if
close img
end tell
end repeat
tell application "Finder"
move hd to hdFolder
end tell