-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jason Sadler
committed
May 23, 2017
0 parents
commit 4850fd7
Showing
9 changed files
with
306 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>NSServices</key> | ||
<array> | ||
<dict> | ||
<key>NSMenuItem</key> | ||
<dict> | ||
<key>default</key> | ||
<string>Concatenate Images</string> | ||
</dict> | ||
<key>NSMessage</key> | ||
<string>runWorkflowAsService</string> | ||
<key>NSRequiredContext</key> | ||
<dict> | ||
<key>NSApplicationIdentifier</key> | ||
<string>com.apple.finder</string> | ||
</dict> | ||
<key>NSSendFileTypes</key> | ||
<array> | ||
<string>public.image</string> | ||
</array> | ||
</dict> | ||
</array> | ||
</dict> | ||
</plist> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,227 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>AMApplicationBuild</key> | ||
<string>428</string> | ||
<key>AMApplicationVersion</key> | ||
<string>2.7</string> | ||
<key>AMDocumentVersion</key> | ||
<string>2</string> | ||
<key>actions</key> | ||
<array> | ||
<dict> | ||
<key>action</key> | ||
<dict> | ||
<key>AMAccepts</key> | ||
<dict> | ||
<key>Container</key> | ||
<string>List</string> | ||
<key>Optional</key> | ||
<true/> | ||
<key>Types</key> | ||
<array> | ||
<string>com.apple.cocoa.string</string> | ||
</array> | ||
</dict> | ||
<key>AMActionVersion</key> | ||
<string>2.0.3</string> | ||
<key>AMApplication</key> | ||
<array> | ||
<string>Automator</string> | ||
</array> | ||
<key>AMParameterProperties</key> | ||
<dict> | ||
<key>COMMAND_STRING</key> | ||
<dict/> | ||
<key>CheckedForUserDefaultShell</key> | ||
<dict/> | ||
<key>inputMethod</key> | ||
<dict/> | ||
<key>shell</key> | ||
<dict/> | ||
<key>source</key> | ||
<dict/> | ||
</dict> | ||
<key>AMProvides</key> | ||
<dict> | ||
<key>Container</key> | ||
<string>List</string> | ||
<key>Types</key> | ||
<array> | ||
<string>com.apple.cocoa.string</string> | ||
</array> | ||
</dict> | ||
<key>ActionBundlePath</key> | ||
<string>/System/Library/Automator/Run Shell Script.action</string> | ||
<key>ActionName</key> | ||
<string>Run Shell Script</string> | ||
<key>ActionParameters</key> | ||
<dict> | ||
<key>COMMAND_STRING</key> | ||
<string>#!/bin/bash | ||
set -e | ||
|
||
OLDIFS=$IFS | ||
IFS="$(printf '\n\t')" | ||
|
||
NEWLINE=$'\n' | ||
|
||
FILES="" | ||
for file in $@; do | ||
if [ -e "$file" ] ; then | ||
FILES="$FILES$file$NEWLINE" | ||
fi | ||
done | ||
|
||
# FILES=$(echo "$FILES" | sed -e 's/ /\ | ||
# /g' | perl -e '$f=sub{eval(`/usr/local/bin/identify -format %w*%h ${\quotemeta(shift)} 2>/dev/null`)};print sort{$f->($b)<=>$f->($a)}<>') | ||
# | ||
FILES=$(echo "$FILES" | perl -e '$f=sub{eval(`/usr/local/bin/identify -format %w*%h ${\quotemeta(shift)} 2>/dev/null`)};print sort{$f->($b)<=>$f->($a)}<>') | ||
|
||
/usr/local/bin/montage -mode Concatenate -gravity "SouthWest" -tile x1 -geometry '+0+0' $FILES /tmp/concatenate-images-output.png | ||
|
||
osascript -e 'set the clipboard to (read (POSIX file "/tmp/concatenate-images-output.png") as JPEG picture)' | ||
|
||
/usr/local/bin/terminal-notifier -message "Combined image copied to clipboard." -title "Concatenate Images" -contentImage "file:///tmp/concatenate-images-output.png" -open "file:///tmp/concatenate-images-output.png" -sender "com.apple.Preview" -group "Concatenate-Images" | ||
|
||
IFS=$OLDIFS</string> | ||
<key>CheckedForUserDefaultShell</key> | ||
<true/> | ||
<key>inputMethod</key> | ||
<integer>1</integer> | ||
<key>shell</key> | ||
<string>/bin/bash</string> | ||
<key>source</key> | ||
<string></string> | ||
</dict> | ||
<key>BundleIdentifier</key> | ||
<string>com.apple.RunShellScript</string> | ||
<key>CFBundleVersion</key> | ||
<string>2.0.3</string> | ||
<key>CanShowSelectedItemsWhenRun</key> | ||
<false/> | ||
<key>CanShowWhenRun</key> | ||
<true/> | ||
<key>Category</key> | ||
<array> | ||
<string>AMCategoryUtilities</string> | ||
</array> | ||
<key>Class Name</key> | ||
<string>RunShellScriptAction</string> | ||
<key>InputUUID</key> | ||
<string>1397A8A3-425A-43B0-9FA5-1B7AD416CBBB</string> | ||
<key>Keywords</key> | ||
<array> | ||
<string>Shell</string> | ||
<string>Script</string> | ||
<string>Command</string> | ||
<string>Run</string> | ||
<string>Unix</string> | ||
</array> | ||
<key>OutputUUID</key> | ||
<string>62A619F4-4F44-42A8-BA6D-336D00D64160</string> | ||
<key>UUID</key> | ||
<string>2C20EA4A-8E05-4ACF-8631-4CC727425C4B</string> | ||
<key>UnlocalizedApplications</key> | ||
<array> | ||
<string>Automator</string> | ||
</array> | ||
<key>arguments</key> | ||
<dict> | ||
<key>0</key> | ||
<dict> | ||
<key>default value</key> | ||
<integer>0</integer> | ||
<key>name</key> | ||
<string>inputMethod</string> | ||
<key>required</key> | ||
<string>0</string> | ||
<key>type</key> | ||
<string>0</string> | ||
<key>uuid</key> | ||
<string>0</string> | ||
</dict> | ||
<key>1</key> | ||
<dict> | ||
<key>default value</key> | ||
<string></string> | ||
<key>name</key> | ||
<string>source</string> | ||
<key>required</key> | ||
<string>0</string> | ||
<key>type</key> | ||
<string>0</string> | ||
<key>uuid</key> | ||
<string>1</string> | ||
</dict> | ||
<key>2</key> | ||
<dict> | ||
<key>default value</key> | ||
<false/> | ||
<key>name</key> | ||
<string>CheckedForUserDefaultShell</string> | ||
<key>required</key> | ||
<string>0</string> | ||
<key>type</key> | ||
<string>0</string> | ||
<key>uuid</key> | ||
<string>2</string> | ||
</dict> | ||
<key>3</key> | ||
<dict> | ||
<key>default value</key> | ||
<string></string> | ||
<key>name</key> | ||
<string>COMMAND_STRING</string> | ||
<key>required</key> | ||
<string>0</string> | ||
<key>type</key> | ||
<string>0</string> | ||
<key>uuid</key> | ||
<string>3</string> | ||
</dict> | ||
<key>4</key> | ||
<dict> | ||
<key>default value</key> | ||
<string>/bin/sh</string> | ||
<key>name</key> | ||
<string>shell</string> | ||
<key>required</key> | ||
<string>0</string> | ||
<key>type</key> | ||
<string>0</string> | ||
<key>uuid</key> | ||
<string>4</string> | ||
</dict> | ||
</dict> | ||
<key>isViewVisible</key> | ||
<true/> | ||
<key>location</key> | ||
<string>309.000000:433.000000</string> | ||
<key>nibPath</key> | ||
<string>/System/Library/Automator/Run Shell Script.action/Contents/Resources/English.lproj/main.nib</string> | ||
</dict> | ||
<key>isViewVisible</key> | ||
<true/> | ||
</dict> | ||
</array> | ||
<key>connectors</key> | ||
<dict/> | ||
<key>workflowMetaData</key> | ||
<dict> | ||
<key>serviceApplicationBundleID</key> | ||
<string>com.apple.finder</string> | ||
<key>serviceApplicationPath</key> | ||
<string>/System/Library/CoreServices/Finder.app</string> | ||
<key>serviceInputTypeIdentifier</key> | ||
<string>com.apple.Automator.fileSystemObject.image</string> | ||
<key>serviceOutputTypeIdentifier</key> | ||
<string>com.apple.Automator.nothing</string> | ||
<key>serviceProcessesInput</key> | ||
<integer>0</integer> | ||
<key>workflowTypeIdentifier</key> | ||
<string>com.apple.Automator.servicesMenu</string> | ||
</dict> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Copyright 2017 Jason Sadler | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
Concatenate Images Automator Workflow | ||
=== | ||
|
||
An Automator workflow that combines several images into a single file with each image in a row, from largest to smallest. Its original purpose was to put screenshots from iOS simulators of different sizes into one image. This has been super useful to show designers and code reviewers what a UI will look like on all supported devices at once. | ||
|
||
Prerequisites | ||
--- | ||
This workflow uses `imagemagick` to create the image and `terminal-notifier` to communicate that work is complete. | ||
|
||
```bash | ||
brew install imagemagick | ||
brew install terminal-notifier | ||
``` | ||
|
||
Installation | ||
--- | ||
Copy `Concatenate Images.workflow` into `~/Library/Services`. That's it! | ||
|
||
Usage | ||
--- | ||
Select the images you want to combine in Finder, right click, and select `Concatenate Images` from the `Services` sub-menu. This will take a few seconds, so be patient. A notification will show when the task is complete. | ||
|
||
The final image will show all selected images in a horizontal row, in order from largest to smallest, regardless of which order in which the images were selected. | ||
|
||
After the workflow completes: | ||
- The final image should be in your clipboard | ||
- The final image will be saved at `/tmp/concatenate-images-output.png` | ||
- Clicking on the notification will open the image from its location in `/tmp` | ||
|
||
Example | ||
--- | ||
I've taken screenshots of the home screens from simulators for iPhone 4s, iPhone 5, iPhone 6, and iPhone 6s. | ||
|
||
Running the workflow: | ||
![Screenshot of selecting images and running Concatenate Images workflow from the Services menu](example-images/usage-1.png) | ||
|
||
The notification saying work is complete: | ||
![Screenshot of the notification](example-images/usage-2.png) | ||
|
||
The results: | ||
![The results of running the workflow](example-images/concatenate-images-output.png) | ||
|
||
License | ||
--- | ||
[MIT License](LICENSE) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.