Created
April 13, 2017 19:17
-
-
Save plexus/f297cc875191d785eccadd093ec6c006 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Command line glitch script. Requires `convert' (ImageMagick) and `sox' | |
# | |
# Usage: ./glitch <image_name> | |
# | |
# The result ends up in glitch.png | |
export HEADER_SIZE=1000 | |
export SOX_IN="-r 44100 -b 32 -e unsigned-integer" | |
# This is where the fun starts, look at the man page for sox, skip to the | |
# "effects" section, and try them out! | |
#export SOX_OUT="gain -nh bandreject 5 300" | |
#export SOX_OUT="gain -nh bass +10 " | |
#export SOX_OUT="chorus 1 2 70 0.05 0.1 1.4 -t" | |
export SOX_OUT="dcshift +1" | |
convert $1 tmp_input.bmp | |
split -d -b $HEADER_SIZE tmp_input.bmp tmp_chunk_ | |
mv tmp_chunk_00 tmp_header.raw | |
cat tmp_chunk_* > tmp_body.raw | |
`sox $SOX_IN tmp_body.raw tmp_output.raw $SOX_OUT` | |
cat tmp_header.raw tmp_output.raw > tmp_result.bmp | |
truncate --size=`wc -c tmp_input.bmp` tmp_result.bmp | |
convert tmp_result.bmp glitch.png | |
rm -f tmp_* | |
eog glitch.png |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment