Bilder klein rechnen mit AppleScript

Ich habe schon länge nach eine Lösung gesucht, wie ich schnell und einfach Bild für das Internet klein rechnen könnte. Die Tools, die das bisher konnten, waren aber nicht immer kostenlos oder umständlich. Seit 10.4 denke oder doch ehr 10.5 gibt es aber die ImageEvents für Apple
}und damit kann man recht einfach Bild klein rechnen. Das hier gezeigte Skript (Droplet, d.h. man zieht die Bilder einfach auf eine Programm-Version des Skriptes) habe ich in einem Forum-Beitrag bei macscripter.net gefunden. Sehr praktisch und nun fest in meinem Dock =)

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

try

rescale_and_save(this_item, mh)

end try

end repeat

end open



to rescale_and_save(this_item, target_width)

tell application "Image Events"

launch

-- open the image file

set this_image to open this_item

set typ to this_image's file type

copy dimensions of this_image to {current_width, current_height}

if current_width is greater than current_height then

scale this_image to size target_width

else

-- figure out new height

-- y2 = (y1 * x2) / x1

set the new_height to (current_height * target_width) / current_width

scale this_image to size new_height

end if

tell application "Finder" to set new_item to ¬

(container of this_item as string) & "scaled." & (name of this_item)

save this_image in new_item as typ

end tell

end rescale_and_save

This entry was posted in AppleScript and tagged , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

One Trackback

  1. [...] 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 [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

CAPTCHA:


9 × three =

Subscribe without commenting

  • Seite übersetzen:


    Paypal for Pizza:




  • Kategorien


  • Letzte Kommentare

    • Niklas: Vielen Vielen Dank! So klappt es!
    • hubi: Servus Niklas, ich habe mir den Quellcode noch einmal angesehen und habe nun unter 10.7.3 einen Weg gefunden...
    • Niklas: Klingt super das Script. Leider bekomm ich immer folgende Fehlermeldung: error “„Mail“ hat einen Fehler...
    • Jürgen: Hallo Hubi, beim Abfragen von Kennworten gibt es noch eine böse Falle: Das Format, in dem security antwortet,...
    • hubi: Am einfachsten Du öffnest im AppleScript-Editor mal das Funktionsverzeichnis (unter Ablage) von iTunes. Ein...