Automator: Ausgewählte Bilder in einen neuen Ordner anhand gewisser Größe skalieren?

B

buddyspencer

unregistriert
Thread Starter
Dabei seit
24.09.2005
Beiträge
1.625
Reaktionspunkte
14
Hallo Zusammen,

Ich hätte gerne eine Automator-Aktion, welche mir folgendes macht:

- ich wähle in einem Ordner div. Bilder aus
- diese ziehe ich auf einen anderen Ordner oder sage mit der rechten Maustaste > Script ausführen
- dass eben die ausgewählten Bilder in einen neuen Ordner (den ich jetzt nach Abfrage definieren kann) skaliert (die Skalierung soll dabei auch abgefragt werden).

Ist so etwas möglich? Falls ja, würde ich mich über Hilfe freuen.
 
Das könnte nur mit dem Automator schwierig werden, insbesondere das abfragen der Größe. Mit AppleScript geht das aber sehr einfach, du musst nur in Automator einen neuen Dienst erstellen, der so aussieht (ungetestet):

attachment.php


Und so das AppleScript:

Code:
[COLOR=#000000][FONT=Verdana][B]on[/B] [/FONT][/COLOR][COLOR=#0433FF][FONT=Verdana][B]run[/B][/FONT][/COLOR][COLOR=#000000][FONT=Verdana] {[/FONT][/COLOR][COLOR=#4F8F00][FONT=Verdana]input[/FONT][/COLOR][COLOR=#000000][FONT=Verdana], [/FONT][/COLOR][COLOR=#4F8F00][FONT=Verdana]parameters[/FONT][/COLOR][COLOR=#000000][FONT=Verdana]}[/FONT][/COLOR]
[FONT=Verdana]    [B]set[/B] [COLOR=#4f8f00]maxLength[/COLOR] [B]to[/B] [COLOR=#812fdc]text returned[/COLOR] [B]of[/B] ([COLOR=#0433ff][B]display dialog[/B][/COLOR] "Bitte geben Sie die maximale Größe (in Pixeln) der längsten Seite des Bildes ein: " [COLOR=#0433ff]default answer[/COLOR] "") [B]as[/B] [COLOR=#0433ff][I]integer[/I][/COLOR][/FONT]
[FONT=Verdana]    [B]repeat[/B] [B]with[/B] [COLOR=#4f8f00]anItem[/COLOR] [B]in[/B] [COLOR=#4f8f00]input[/COLOR][/FONT]
[COLOR=#5E6161][FONT=Verdana](* Auszug aus der man-Page für sips:[/FONT][/COLOR]

[COLOR=#5E6161][FONT=Verdana]-r degreesCW[/FONT][/COLOR]
[COLOR=#5E6161][FONT=Verdana]     --rotate degreesCW[/FONT][/COLOR]
[COLOR=#5E6161][FONT=Verdana]
[/FONT][/COLOR]
[COLOR=#5E6161][FONT=Verdana]     -f horizontal|vertical[/FONT][/COLOR]
[COLOR=#5E6161][FONT=Verdana]     --flip horizontal|vertical[/FONT][/COLOR]
[COLOR=#5E6161][FONT=Verdana]
[/FONT][/COLOR]
[COLOR=#5E6161][FONT=Verdana]     -c pixelsH pixelsW[/FONT][/COLOR]
[COLOR=#5E6161][FONT=Verdana]     --cropToHeightWidth pixelsH pixelsW[/FONT][/COLOR]
[COLOR=#5E6161][FONT=Verdana]           Crop image to fit specified size.[/FONT][/COLOR]
[COLOR=#5E6161][FONT=Verdana]
[/FONT][/COLOR]
[COLOR=#5E6161][FONT=Verdana]     -p pixelsH pixelsW[/FONT][/COLOR]
[COLOR=#5E6161][FONT=Verdana]     --padToHeightWidth pixelsH pixelsW[/FONT][/COLOR]
[COLOR=#5E6161][FONT=Verdana]           Pad image with pixels to fit specified size.[/FONT][/COLOR]
[COLOR=#5E6161][FONT=Verdana]
[/FONT][/COLOR]
[COLOR=#5E6161][FONT=Verdana]     --padColor hexcolor[/FONT][/COLOR]
[COLOR=#5E6161][FONT=Verdana]           Use this color when padding. White=FFFFFF, Red=FF0000,[/FONT][/COLOR]
[COLOR=#5E6161][FONT=Verdana]           Default=Black=000000[/FONT][/COLOR]
[COLOR=#5E6161][FONT=Verdana]
[/FONT][/COLOR]
[COLOR=#5E6161][FONT=Verdana]     -z pixelsH pixelsW[/FONT][/COLOR]
[COLOR=#5E6161][FONT=Verdana]     --resampleHeightWidth pixelsH pixelsW[/FONT][/COLOR]
[COLOR=#5E6161][FONT=Verdana]           Resample image at specified size. Image apsect ratio may be[/FONT][/COLOR]
[COLOR=#5E6161][FONT=Verdana]           altered.[/FONT][/COLOR]
[COLOR=#5E6161][FONT=Verdana]
[/FONT][/COLOR]
[COLOR=#5E6161][FONT=Verdana]     --resampleWidth pixelsW[/FONT][/COLOR]
[COLOR=#5E6161][FONT=Verdana]           Resample image to specified width.[/FONT][/COLOR]
[COLOR=#5E6161][FONT=Verdana]
[/FONT][/COLOR]
[COLOR=#5E6161][FONT=Verdana]     --resampleHeight pixelsH[/FONT][/COLOR]
[COLOR=#5E6161][FONT=Verdana]           Resample image to specified height.[/FONT][/COLOR]
[COLOR=#5E6161][FONT=Verdana]
[/FONT][/COLOR]
[COLOR=#5E6161][FONT=Verdana]     -Z pixelsWH[/FONT][/COLOR]
[COLOR=#5E6161][FONT=Verdana]     --resampleHeightWidthMax pixelsWH[/FONT][/COLOR]
[COLOR=#5E6161][FONT=Verdana]           Resample image so height and width aren't greater than specified[/FONT][/COLOR]
[COLOR=#5E6161][FONT=Verdana]           size.[/FONT][/COLOR]
[COLOR=#5E6161][FONT=Verdana]*)[/FONT][/COLOR]
[FONT=Verdana]        [COLOR=#012fbe][B]do shell script[/B][/COLOR] "sips --resampleHeightWidthMax " & [COLOR=#4f8f00]maxLength[/COLOR] & [COLOR=#812fdc]space[/COLOR] & [COLOR=#812fdc]quoted form[/COLOR] [B]of[/B] [COLOR=#812fdc]POSIX path[/COLOR] [B]of[/B] [COLOR=#4f8f00]anItem[/COLOR][/FONT]
[FONT=Verdana]    [B]end[/B] [B]repeat[/B][/FONT]
[B]end [/B][COLOR=#0433FF][FONT=Verdana][B]run[/B][/FONT][/COLOR]

Je nach welchen Kriterien du skalieren möchtest (längste Seite, Breite, Höhe, Breite und Höhe) kannst du --resampleHeightWidthMax ​abändern.
 

Anhänge

  • Bildschirmfoto 2013-01-21 um 16.31.44.png
    Bildschirmfoto 2013-01-21 um 16.31.44.png
    68,9 KB · Aufrufe: 182
Zurück
Oben Unten