Skip to content

Instantly share code, notes, and snippets.

@Birchwell
Birchwell / convertvideo.sh
Created October 18, 2015 00:26
Convert video to avi, 3gp, flv, mov, mp4, asf, wmv, mkv, mpg. The video and audio bitrates can be customized.
!# /bin/bash
ConvertTo=$(zenity --list --column="Select One" --title="Video
Converter" --height=300 --width=250 --text="Select the format
to convert to" avi 3gp flv webm mov mp4 mkv asf wmv mpg mov)
@Birchwell
Birchwell / convert-image.sh
Created October 18, 2015 00:31
Convert images to many formats. Quality can be set. The converted images will be placed in a separate folder and the originals will be intact. Zenity must be installed.
#! /bin/sh
# Increment and count the number of files passed to the script
# for later use in the progress dialog box
n=1
# Ask for the destination graphic image format to change to
# Next line is entered all on one line
EXT=`zenity --title="Convert Image" --entry --text="Please
enter the image format to convert to (e.g. PNG, JPG, TIFF, WEBP etc.)"`
@Birchwell
Birchwell / gmicmontagepics.sh
Last active February 8, 2019 10:42
This G'Mic script will go through a folder of many images and output multiple montages in the working folder. The script can be modified to customize the number of images to turn into individual montages by changing the "4" in "(expr $c % 4)" to whatever number desired. Can be used with Thunar Custom Actions.
#!/bin/bash
c=0
for i in *.jpg; do
c=$(($c+1))
f="$f $i"
test "$(expr $c % 4)" != 0 && continue
gmic $f -fx_montage 4,\""V(H(0,1),H(2,V(3,4)))"\",1,1.0,0,5,0,0,0,255,0,0,0,0,0 -o output-$c.jpg
f=""
done
@Birchwell
Birchwell / gmicmontagefolderimages.sh
Last active February 8, 2019 10:41
This G'Mic bash script allows for turning a folder of images into a montage. Can be used with Thunar Custom Actions.
#!/bin/bash
find -type d -exec sh -c '
cd "$0"
set -- *.jpg
if [ -e "$1" ]; then
gmic "$@" -fx_montage 4,\""V(H(0,1),H(2,V(3,4)))"\",1,1.0,0,5,0,0,0,255,0,0,0,0,0 -o 0000."$(date)".jpg
fi
' {} \;
@Birchwell
Birchwell / nix.sh
Created October 17, 2015 13:07
This script will produce contact sheets of videos.
#!/usr/bin/env bash
#
# $Rev: 583 $ $Date: 2014-05-18 18:50:42 +0200 (dg, 18 mai 2014) $
#
# vcs
# Video Contact Sheet *NIX: Generates contact sheets (previews) of videos
#
# Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Toni Corvera
#
# This program is free software; you can redistribute it and/or
@Birchwell
Birchwell / exiftooladdmetadata.sh
Last active October 24, 2015 02:54
This Exiftool bash script will allow the user to populate 18 YAD fields with metadata for images. Useful for uploading images to Flickr.
#!/bin/bash
exiftoolform=$(yad --title "ExifTool" --form --width=700 --columns=2 --field="Artist:" --field="Copyright:" --field="City:" --field="State:" --field="Country:" --field="Creator:" --field="Rights:" --field="By-line:" --field="Headline:" --field="Description:" --field="Keywords 1:" --field="Keywords 2:" --field="Keywords 3:" --field="Keywords 4:" --field="Keywords 5:" --field="Keywords 6:" --field="Keywords 7:" --field="Keywords 8:" "John Doe" "(c) 2015 John Doe" "Chicago" "Illinois" "United States" "John Doe" "(c) 2015 John Doe" "John Doe")
OldIFS="$IFS"; IFS='|' # Save the old IFS value to OldIFS and give the new value to IFS.
read ARTIST COPYRIGHT CITY STATE COUNTRY CREATOR RIGHTS BYLINE HEADLINE DESCRIPTION KEYWORDSONE KEYWORDSTWO KEYWORDSTHREE KEYWORDSFOUR KEYWORDSFIVE KEYWORDSSIX KEYWORDSSEVEN KEYWORDSEIGHT <<< "$exiftoolform"
IFS="$OldIFS" # Give IFS back its original value.
exiftool -artist="$ARTIST" -copyright="$COPYRIGHT" -city="$CITY" -state="$STATE" -country="$COUNTRY" -creator="$CREA
@Birchwell
Birchwell / videotogif.sh
Created October 18, 2015 00:22
This bash script will work on multiple video files, outputting multiple GIFs renamed with incremental numbering.
#!/bin/bash
for f in ./*.mp4; do
ffmpeg -i "$f" -vf scale=420:-1 -t 10 -r 10 "${f%.*}.gif"
done
@Birchwell
Birchwell / file-size.sh
Created October 18, 2015 00:00
Shows the actual size of files in Thunar. Thunar has a strange problem of not reporting the correct size of files.
#! /bin/bash
kb=$((2**10))
mb=$((2**20))
for file in $@; do
if [ ! -e $file ]; then
continue
fi
b1=`ls -l $file | cut -d" " -f5`
@Birchwell
Birchwell / movefilesdir.sh
Created October 17, 2015 23:55
Divide files in folder into many folders. Customizable by changing number of files.
#!/bin/bash
c=1; d=1; mkdir -p dir_${d}
for file in *
do
if [ $c -eq 600 ]
then
d=$(( d + 1 )); c=0; mkdir -p dir_${d}
fi
@Birchwell
Birchwell / nix.sh
Created October 17, 2015 23:51
This Custom Action will produce contact sheets of videos. I found it here: http://p.outlyer.net/vcs/#issues
#!/usr/bin/env bash
#
# $Rev: 583 $ $Date: 2014-05-18 18:50:42 +0200 (dg, 18 mai 2014) $
#
# vcs
# Video Contact Sheet *NIX: Generates contact sheets (previews) of videos
#
# Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Toni Corvera
#
# This program is free software; you can redistribute it and/or