curl -sL https://raw.githubusercontent.com/QubitPi/reusable-bash-scripts/refs/heads/master/docker-clean.sh | bash
Adds paddings of an image to make it with certain dimension. To use this script, install ImageMagick first. For example, on Mac, install by
brew update
brew install imagemagick
Tip
To install this script, place it under OS executable path. For example, On mac put this under "/usr/local/bin/"
The following examples assumes the input image is "input.png" and output image will be "output.png":
-
Add transparent paddings to make a square image with the side being the larger one of original's width or height:
curl -sL https://raw.githubusercontent.com/QubitPi/reusable-bash-scripts/refs/heads/master/add-padding.sh | bash -s -- input.png output.png
-
Add transparent paddings to make an image with dimension 1920x1080:
curl -sL https://raw.githubusercontent.com/QubitPi/reusable-bash-scripts/refs/heads/master/add-padding.sh | bash -s -- input.png output.png 1920x1080
-
Add paddings, whose color is #00CC00, to make an image with dimension 1920x1080:
curl -sL https://raw.githubusercontent.com/QubitPi/reusable-bash-scripts/refs/heads/master/add-padding.sh | bash -s -- input.png output.png 1920x1080 #00CC00
curl -sL https://raw.githubusercontent.com/QubitPi/reusable-bash-scripts/refs/heads/master/loop.sh | bash -s -- <command>
The use and distribution terms for reusable-bash-scripts are covered by the Apache License, Version 2.0.