Batch PNG Convert

21/07/2011
Sehr nützliches sips-Skript mkdir pngs; sips -s format png *.* --out pngs Einfach in einem Verzeichnis mit z.B. eine Menge PSD-Dateien ausführen und man bekommt recht schnell eine PNG-Version dieser Dateien.
No Comments

AppleScript: PDFs verkleinern – Droplet

22/03/2010
Das ist quasi die Vorstufe von dem Automator Skript gewesen... Nutzt sips zum verkleinern der Dateien. Hier also der Code des Skript-Droplets:
Code zum markieren einmal anklicken Code im Skript-Editor öffnen

on open these

repeat with this in these

tell application "Finder"

if name of this ends with ".pdf" then

set newname to (characters 1 through -5 of ((name of this) as text)) as text

set newname to newname & "_mail.pdf"

do shell script "sips -s format pdf -s dpiHeight 72 -s dpiWidth 72 -s formatOptions low " & quoted form of POSIX path of this & " " & "--out " & quoted form of POSIX path of ((container of this) as alias) & quoted form of newname

end if

end tell

end repeat

end open

3 Comments

AppleScript: Alternative zu ImageEvents

12/03/2010
Anstatt die ImageEvents via AppleScript anzusteuern, kann man auch über ein Shell Script (das dürfte vielleicht schneller sein) auch sips (scriptable image processing system) aufrufen. Damit kann man sogar die Auflösung von Grafiken in PDFs verändern: sips -s format pdf -s dpiHeight 72 -s dpiWidth 72 -s formatOptions low /path/to/pdf.pdf --out /path/to/converted/pdf.pdfSo ist z.B. auch eine deutlich schlankere Version von diesem Skripte (Bilder klein rechnen mit AppleScript) möglich:
Code zum markieren einmal anklicken Code im Skript-Editor öffnen

on open some_items

tell me to activate

display dialog "Längste Seite" default answer "1024"

set mh to (text returned of the result) as integer

repeat with this_item in some_items

rescale_and_save(this_item, mh)

end repeat

end open

to rescale_and_save(this_item, max_length)

set this_item to quoted form of (POSIX path of this_item)

set scaled_dir_path to (do shell script "dirname " & this_item) & "/_scaled/"

do shell script "mkdir -p '" & scaled_dir_path & "';sips -Z " & max_length & " " & this_item & " --out '" & scaled_dir_path & quoted form of (do shell script "basename " & this_item) & "'"

end rescale_and_save

No Comments