X-Git-Url: https://git.danix.xyz/?a=blobdiff_plain;f=content%2Farticles%2Fgify-back-to-bash-scripting.md;h=09b3fa2f60655dc538b31ec5aa3b03b4c2ff21e5;hb=d56fc2d0cc28fea93c94f7800ec231cfdb161004;hp=6737a632d062e12f5bcf6d585d32d82583429b92;hpb=ae9e44784afc692781c424163c42abd9a1eeb000;p=danix.xyz.git diff --git a/content/articles/gify-back-to-bash-scripting.md b/content/articles/gify-back-to-bash-scripting.md index 6737a63..09b3fa2 100644 --- a/content/articles/gify-back-to-bash-scripting.md +++ b/content/articles/gify-back-to-bash-scripting.md @@ -1,7 +1,7 @@ --- title: gify.sh â back to bash scripting author: Danilo M. -type: post +type: article date: 2016-01-25T12:41:06+00:00 featured_image: /uploads/2016/01/G0092546.jpg categories: @@ -17,39 +17,38 @@ tags: - script --- -
gify.sh --resize 900 jpg
+```bash
+gify.sh --resize 900 jpg
+```
-depending on the amount of images it may take a while, and when it’s done you’ll have all of your jpg resized to 900px wide and with proportional height.
+depending on the amount of images it may take a while, and when it's done you'll have all of your jpg resized to 900px wide and with proportional height.
-now it’s time to render all of your jpg into one animated gif so, while in the same directory, run the script like this:
+now it's time to render all of your jpg into one animated gif so, while in the same directory, run the script like this:
-gify.sh --gif 10 jpg paris
+```bash
+gify.sh --gif 10 jpg paris
+```
-the parameters now are a bit different, first we tell the script that we want to create a gif with the `--gif` option, then we tell the interval between every frame, that number is expressed in 100th of a second, so now we are telling the gif to change frame every 10/100 of second, the following parameter is the extension of the images we’ll be using, in our example is jpg (it’s case sensitive, so make sure all the images you want to use have the same extension), and finally we set the name of the gif, without the extension, the script will provide it for us.
+the parameters now are a bit different, first we tell the script that we want to create a gif with the `--gif` option, then we tell the interval between every frame, that number is expressed in 100th of a second, so now we are telling the gif to change frame every 10/100 of second, the following parameter is the extension of the images we'll be using, in our example is jpg (it's case sensitive, so make sure all the images you want to use have the same extension), and finally we set the name of the gif, without the extension, the script will provide it for us.
The gif you see at the beginning of the article was created with this script.
-I made this script mostly for fun and personal use, so it’s absolutely not idiot proof, can be improved but for me it works just fine. If you want to modify it, feel free to fork it on github or just download it and do whatever you like with it, and if you want to share it with me, use the comment form below.
+I made this script mostly for fun and personal use, so it's absolutely not idiot proof, can be improved but for me it works just fine. If you want to modify it, feel free to fork it on github or just download it and do whatever you like with it, and if you want to share it with me, use the comment form below.
-I’ll leave you with a copy of the script here in case you want to have a look at it before downloading.
+I'll leave you with a copy of the script here in case you want to have a look at it before downloading.
Enjoy!
{{< highlight bash "linenos=true" >}}#! /bin/bash
@@ -74,7 +73,7 @@ Enjoy!
# #
#--------------------------------------------------------------------------------#
-# ERROR & EXIT STATUSES
+# ERROR & EXIT STATUSES #
SHOWHELP=61
USERABORTED=62
@@ -85,19 +84,19 @@ E_FILEXISTS=74
E_NOIMAGES=75
E_UNKNOWNOPT=76
-# TOOLS
+# TOOLS #
PWD=$(pwd)
MOGRIFY=$(which mogrify)
CONVERT=$(which convert)
-# we need mogrify and convert from the imagemagik toolset for this script to work
+# we need mogrify and convert from the imagemagik toolset for this script to work #
if [[ ! -x $MOGRIFY || ! -x $CONVERT ]]; then
showerror missingdeps
exit $E_MISSINGDEPS
fi
-# showhelp
+# showhelp #
showhelp ()
{
case $1 in
@@ -131,7 +130,7 @@ case $1 in
esac
}
-# showerror
+# showerror #
showerror ()
{
if [ -z $1 ];then