FabAc 2021

Mauro Herrero-FabLabLeon-URJC

ImageMagick

list formats:
convert -list format

convert JPG to PNG:
convert input.jpg output.png

convert all JPGs to PNGs:
mogrify -format png *.jpg

convert SVG to PNG at 1000 DPI:
convert -density 1000 -units PixelsPerInch input.svg output.png

compress JPG to quality 50% width 1000:
convert input.jpg -quality 50% -resize 1000 output.jpg

compress all JPGs to quality 50% width 1000:
mogrify -quality 50% -resize 1000 *.jpg

concatenate images horizontally:
convert +append src/image1.png src/image2.png out/image12horiz.png

tile images adjusting spacing between them:
montage [0-4].png -tile 5x1 -geometry +0+0 out.png

get image info:
magick identify filename.jpg

bash

Refer to current directory with a dot (.):
mv /path/to/source.txt .

Extract an archive with tar (x=extract, f=file, v=verbose);
tar xfv archive.tar

Create compressed archive: (z=compress with gzip):
tar cfzv archive.tar file1 file2 file3

Create compresseda archive with bzip2:
tar cvfj archive.tar.tbz file1 file2

Add a file to existing archive (r=add file):
tar rvf archive.tar file-to-add.txt

Show all files of an archive:
tar tvf archive.tar

Extract files from gzip tar archive:
tar xvzf archive.tar.gz

Permission for files:
chmod ogw file (owner, group, world)
1 = +x = execute
2 = +w = write
4 = +r = read
3 = 1 + 2 = +xw = execute + write
5 = 1 + 4 = +xr = execute + read
6 = 4 + 2 = +wr = write + read
7 = 1 + 2 + 4 = +xwr = execute + write + read

Add aliases to file:
~/.bash_aliases

Create single line function
funcntion-name () {commands "$1" "$2";}

html

video tag:
<video width=100% src ="../path/to/video.mp4" controls autoplay loop></video>

ffmpeg

trim time (-ss start time, -t duration):
ffmpeg - i input.mp4 -vcodec libx264 -b:v 1000k -an -ss 00:00:10 -t 00:00:15 output.mp4

fixed bit rate 1080p MP2:
ffmpeg -i input_video -vcodec libx264 -b:v 1000k -vf scale=-2:1080 -acodec mp2 -b:a 256k -ar 48000 -ac 2 output_video.mp4

no audio:
ffmpeg -i input_video -vcodec libx264 -b:v 1000k -vf scale=-2:1080 -an output_video.mp4

xubuntu

install fonts:
copy fonts to folder ~/.fonts/; then run sudo fc-cache -f