Wednesday, 3 July 2024

New script I'm working on.


 Above image is the output from a new script that I'm working on which is similar to other scripts that I've created recently but rather than working on a folder of images it grabs an image from your screen , hex edits it ( if you say yes), divides it into a grid of images and reassembles it rotates it in a random direction , then grabs another image from the screen and uses gmic xor to combine the first and second images. It does this and saves the image into new folder and carries on until you ctrl c the script. It requires imagemagick, scrot gmic cli and at the moment is linux only and runs from a bash terminal. Script below is very much a work in progress use at your own risk. ( ps my scripts can now be found on codeberg here )

 

#!/bin/bash
#screen grabbing desktop alter dimensions to suit
#
h=$(pwd)
echo $h
dd=$(date +%Y-%m-%d_%H%M%S)
mkdir $h/$dd
#Questions questions
echo -n "Screen size  1368x768 (s), medium 1600x900 (m), large 1920x1080 (l), box 768x768(1600x900) (b) ? : "
read sc
#
echo -n "Use Stereoscopic colour shifting (y/n) ? : "
read shft
#use splittor
echo -n "Use splittor (y/n) ? : "
read spl
#
echo -n "Make cubes (y/n) ? : "
read cn
#
echo -n "Use Rotation (y/n) ? : "
read ro
if [ $ro == "y" ] || [ $ro == "null" ]
then
#echo -n "Degrees to rotate (0-365) ? : "
#read dg
echo -n "Number of rotations ? : "
read numro
fi  
echo -n "Use Contra-rotation (y/n) ? : "
read cro
#
echo -n "Use gmic xor displacement (y/n) ? : "
read gmc
#
echo -n "multiple(m) or single(s) or none(n) hex Editing ? : "
read hex
if [ $hex == "s" ] || [ $hex == "null" ]
then
echo -n "Target value ? : "
read tr
echo -n "Image format to use ? : "
read f
fi
#

echo "Press CTRL+C to stop..."
#
for ((;;))
do
sleep 15
d=$(date +%Y-%m-%d_%H%M%S)
if [ $sc == "l" ] || [ $sc == "null" ]
then
scrot -z -a 0,0,1920,1080 $h/$dd/$d.png
cd $h/$dd/
 elif [ $sc == "m" ]
 then
 scrot -z -a 0,0,1600,900 $h/$dd/$d.png
cd $h/$dd/
elif [ $sc == "s" ]
then
 scrot -z -a 0,0,1368,768 $h/$dd/$d.png
cd $h/$dd/

elif [ $sc == "b" ]
then
 scrot -z -a 417,97,768,768 $h/$dd/$d.png
cd $h/$dd/
fi


if [ $shft == "y" ] || [ $shft == "null" ]
then
composite -stereo -50+20 $d.png $d.png result.png  
mv result.png $d.png
fi

if [ $hex == "s" ] || [ $hex == "null" ]
then
  to=$(openssl rand -hex 1)
mogrify -format $f $d.png
sed '0,/'$tr'/s//'$to'/' $d.$f > swap.$f
mogrify -format png swap.$f
rm swap.$f
rm $d.$f
mv swap.png $d.png
fi
if [ $hex == "m" ] || [ $hex == "null" ]
then
from=$(openssl rand -hex 1)
  to=$(openssl rand -hex 2)
mogrify -format ppm $d.png
sed 's/\x'$from'/\x'$to'\x'$from'/g' $d.ppm > swap.ppm
#sed '0,/'$from'/s//'$to'/' $d.ppm > swap.ppm
mogrify -format png swap.ppm
rm swap.ppm
rm $d.ppm
mv swap.png $d.png
fi
if [ $spl == "y" ] || [ $spl == "null" ]
then
mogrify -format ppm $d.png

split -n 24 $d.ppm
rm $d.ppm
cat xaa xac xab xae xad xag xaf xai xah xak xaj xam xal xao xan xaq xap xas xar xau xat xaw xav xax  > swap.ppm
mogrify -format png swap.ppm
rm swap.ppm
mv swap.png $d.png
rm xaa xab xac xad xae xaf xag xah xai xaj xak xal xam xan xao xap xaq xar xas xat xau xav xaw xax
fi
#
if [ $cn == "y" ] || [ $cn == "null" ]
          then
          gmic $d.png frame_cube , -o swap.png;
          mv swap.png $d.png;
          fi
if [ $ro == "y" ] || [ $ro == "null" ]
          then
          i=0
          while [ $i -lt $numro ]
            do
            ((i++))
            rnd=$((1 + $RANDOM % 360))
            convert $d.png -distort SRT $rnd rotate.png
            mv rotate.png $d.png
            done
          fi
#
if [ $gmc == "y" ] || [ $gmc == "null" ]
then
#rndx=$((1 + $RANDOM % 450))
#rndy=$((1 + $RANDOM % 800))
scrot -z -a 417,97,768,768 swap.png
if
[ $cro == "y" ] || [ $cro == "null" ]
then
rnd=$((1 + $RANDOM % 360))
convert swap.png -distort SRT -$rnd rotate.png
            mv rotate.png swap.png
fi
gmic $d.png swap.png  -blend xor -o swap2.png
mv swap2.png $d.png
rm swap.png
 

fi

cd $h/

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...