Wie kann ich das Ändern der Qualität mehrerer Fotos automatisieren?
-
16-10-2019 - |
Frage
Ich möchte in der Lage sein, die Qualität der Fotos zu reduzieren, die ich in einem Verzeichnis durch eine Art Automatisierung habe. Eine der Anforderungen ist, dass ich die Dimensionen des Fotos nicht ändern kann. Die Art, wie ich es bisher gemacht habe, ist nur von
- Öffnen Sie jedes Foto in der Vorschau
- Save As wählen
- Auswählen von JPEG
- Auswahl einer geringen Qualität
- sparen
Dies kann lange dauern, wenn ich über 100 Fotos habe. Gibt es eine einfache Möglichkeit, dies mit AppleScript oder über andere Weise zu automatisieren?
Lösung
Hier ist ein einfaches Apfelkript, das die in OS X integrierten Bildveranstaltungen verwendet. Fügen Sie Salz zum Geschmack hinzu.
property kFileList : {}
tell application "Finder"
set theSourceFolder to choose folder
set theDestinationFolder to choose folder
my createList(theSourceFolder)
set lastItem to (count kFileList)
repeat with thisItem from 1 to lastItem
set theFile to (theSourceFolder & item thisItem of kFileList) as string
tell application "Image Events"
set theImage to open theFile
save theImage as JPEG2 in ((theDestinationFolder & item thisItem of kFileList & ".jpg") as string) with compression level high
end tell
end repeat
end tell
on createList(mSource_folder)
set item_list to ""
tell application "System Events"
set item_list to get the name of every disk item of mSource_folder
end tell
set item_count to (get count of items in item_list)
repeat with i from 1 to item_count
set the_properties to ""
set the_item to item i of the item_list
set the_item to ((mSource_folder & the_item) as string) as alias
tell application "System Events"
set file_info to get info for the_item
end tell
if visible of file_info is true then
set file_name to displayed name of file_info
set end of kFileList to file_name
if folder of file_info is true then
my createList(the_item)
end if
end if
end repeat
end createList
Eichel ist auch gut für eine billige und einfache Automatisierung über AppleScript, die mehr Auswahlmöglichkeiten bietet als die Bildveranstaltungen, aber Bildveranstaltungen sind kostenlos