Skip to content

Instantly share code, notes, and snippets.

@Rasukarusan
Created July 6, 2021 03:17
Show Gist options
  • Select an option

  • Save Rasukarusan/bb0241de8934edb8999e7a53d8dd05f8 to your computer and use it in GitHub Desktop.

Select an option

Save Rasukarusan/bb0241de8934edb8999e7a53d8dd05f8 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
main() {
local image=$1
local color=${2:-a0a8a9}
local borderWeight=${3:-10}
local width=$(sips -g pixelWidth $1 | awk -F ' ' '{print $2}')
local height=$(sips -g pixelHeight $1 | awk -F ' ' '{print $2}')
echo $width
echo $height
local borderWidth=$(expr $width + $borderWeight)
local borderHeight=$(expr $height + $borderWeight)
sips -p $borderHeight $borderWidth --padColor $color $image -o border_${image}
}
main $@
# sh test.sh demo.jpg f8d3c5 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment