Thursday, 6 October 2022

Gifatron - automated hexed gifs from one image.

 

This script is a modification of the previous post . It doesnt just glitch a single image randomly using openssl it also outputs those images as a gif . Its tuned more for Tumblr which has a 10mb limit on gifs , it also downsizes the input picture if need be to 640x480 .

On both windows and linux you will need imagemagick installed, on Windows 10 I'd advise installing the version available from the imagemagick website over installing via chocolatey ( from here https://imagemagick.org/script/download.php )plus you will also need git-bash terminal installed,  this will not work in windows powershell!! When asked for no of iterations 5 is probably best to keep down the size. Save the script below as a file with .sh extension and dont forget to make it executable - on linux chmod u+x uncomment the linux bits and comment out the windows bits . This also does some trickery with headers ( I'm converting the input file to pam and then storing the header, stripping it, then adding it back after glitching - it helps stop the file becoming unreadable - doesnt work everytime note so you will see error messages at some point.

Also remember to delete the jpgs created by the process afterwards or they get mixed back into the next gif you make , which you might want but it does make the file bigger !! ( see previous post for description of how to alter random hex generation)

#! /bin/bash
echo -n "name of image ? : "
read f

echo -n "How many iterations (whole number) : "
read n
i=0
#windows
magick convert -resize 640x480\! $f test.pam

#linux
#resize info here https://imagemagick.org/Usage/resize/#resize
#convert -resize 640x480\! $f test.pam

while [ $i -lt $n ]
do
    ((i++))

 #get header
  sed '2,$d' test.pam > head.pam;

#strip header ( to avoid damaging it)
  sed -b '1d'  test.pam > swap.pam
 from=$(openssl rand -hex 1)
  to=$(openssl rand -hex 2)
 
xxd -p swap.pam | sed 's/'$from'/'$to'/g' | xxd -p -r > help.pam

#put the header back
cat head.pam help.pam> headswap.pam;

#windows
magick convert headswap.pam  $i.jpg

#linux
#convert headswap.pam image-00$i.jpg
rm help.pam

done
#morphgif
#windows
magick convert -delay 5 *.jpg -morph 14  gifatron-$from-$to.gif
#linux
#convert -delay 5 *.jpg -morph 14  gifatron-$from-$to.gif


Tuesday, 4 October 2022

Randomly hex images using open ssl

 


In response to a question in an online diwo ( do it with others) session during this years Fubar https://fubar.space/ I came up with a script that uses openssl to generate random hex numbers which can then be used to glitch the same image over and over but with random values. 

The script is below , its a bit rough and ready and requires that you have imagemagick installed ( on windows via chocolatey) and openssl and run it through git-bash. Note the commented out sections - for linux  it works as is for windows comment out the linux section and uncomment the windows section) - I made a gif from the 23  images generated as proof of concept. 

Try adjusting the values after where hex is written ie  

from=$(openssl rand -hex 1)
  to=$(openssl rand -hex 2)

in each case try different values after the -hex upt to 256 ( equal values in each statement will yield little or no change)

 Script is below ( dont forget to chmod u+x it !!)

#! /bin/bash
echo -n "name of image ? : "
read f

echo -n "How many iterations (whole number) : "
read n


i=0
#windows
#magick convert $f test.ppm

#linux
convert $f test.ppm

while [ $i -lt $n ]
do
    ((i++))

 
 from=$(openssl rand -hex 1)
  to=$(openssl rand -hex 2)
 
 
xxd -p test.ppm | sed 's/'$from'/'$to'/g' | xxd -p -r > help.ppm
#windows
#magick convert help.ppm  $i.jpg

#linux
convert help.ppm image-00$i.jpg
rm help.ppm



done


Mark Fisher – ‘Ghosts of my life’, Fukuyama’s ‘End of history’ and rebooting the future with glitch art.

Note- this was the introduction I gave during a recent online discussion with Verena Voigt ( https://www.verena-voigt-pr.de/ ) a...