Bash: Glitch images using sed



Once an image is converted to text (via ImageMagick) any form of text manipulation can be used (not just sed) to create different results. The process is slow however, and should be seen as a novelty rather than a legitimate alternative to pixel-array manipulation in a different programming environment.

# Use ImageMagick to convert image to text file
convert merkel.jpg merkel.txt

# sed replaces every occurrence of $i value with '0' (except in first line)
for (( i=0; i<255; i++))
{ 
   sed '1! s,'"$i"',0,g' < merkel.txt \
   | convert - "merkel_$i.png"
}
Animated effects can also be interesting...