Saturday, 30 September 2023

Xor everything - script to use gmic displacement on multiple images

 




A script to use gmic to displace adjacent images in a folder and output into a second folder - should work on Linux and Windows ( using git-bash and downloading gmic cli and placing it in the C:\Program Files\Git\usr\bin directory) . Copy script into notepad ++ and save as file with .sh extension. It also handily resizes all images to the same size before operating the gmic function.

#! /bin/bash
#make directory to hold output
h=$(pwd)
echo $h
#make folder to store originals
mkdir $h/originals
mkdir $h/frames
p=$(date +%Y-%m-%d_%H%M%S)
mkdir $p
echo -n "Source image format ? : "
read f
#copy originals to $h/originals
cp *.$f $h/originals/
#randomise
echo -n "Randomise ? (y/n) : "
read rn
if [ $rn == "y" ] || [ $rn == "null" ]
          then
          find . -maxdepth 1 -name '*.'$f''|while read filename; do echo ${filename}; mv ${filename} ${RANDOM}.$f; done  
          elif [ $rn == "n" ]
           then
           echo -n "Not randomising"
           fi
                     
#get dimensions
echo -n "Landscape(l),square(s),portrait(p)? : "
read lsp
#modify to size depending lsp variable
if [ $lsp == "s" ] || [ $lsp == "null" ]
          then   
          mogrify -resize 800x800! *.$f      
             
           elif [ $lsp == "l" ]
           then
           mogrify -resize 800x600! *.$f
           elif [ $lsp == "p" ]
           then
           mogrify -resize 600x800! *.$f
          
           fi
i=$(ls *.$f | wc -l)
echo $i
while [ $i -gt 0 ]
do
#move 2 files to $h/frames with find
find . -maxdepth 1 -name '*.'$f'' | head -n 2 | xargs -d $'\n' mv -t $h/frames/

#move to frames directory
cd $h/frames/
z=1
#rename files to swap1 and swap2
find . -maxdepth 1 -type f -name '*.'$f''|while read filename; do echo ${filename};
mv ${filename} swap$z.$f
((z++));
done
gmic swap1.$f swap2.$f  -blend xor -o swap3.$f
d=$(date +%Y-%m-%d_%H%M%S)
mv swap3.$f $h/$p/$d.$f
sleep 1
rm swap1.$f
rm swap2.$f
cd $h
i=$((i-=2))
done



Tuesday, 26 September 2023

Grid and split your images.

 

With Xavier Dallet aka chan-something star


Whoppa whoppa whoppa

Ever wanted to take a series of images and make grids from them? Ever wanted to loop over the images and create ever more fractured but yet somehow consistent glitchy grids? Then this script is for you. Inspired by Xavier Dallet aka chan somethingstar and his Instagram group Baobab users  https://www.instagram.com/baobab_users/

Requires imagemagick, bash and a basic knowledge of how to run shell scripts. Linux Script below. Name it and save with .sh extension.  Modified version for  windows 10+ using git bash, after the linux version - I've tested both as working.

#! /bin/bash
#make directory to hold output
h=$(pwd)
echo $h
#make folder to store originals
mkdir $h/originals
mkdir $h/frames
#make folder to hold output
mkdir rotator
#get formats to use
echo -n "Source image format ? : "
read f
echo -n "Image format to use  ? : "
read t
echo -n "Discard cut in ? : "
read disin
echo -n "No to discard ? : "
read dis
#get grid dimensions
echo -n "Grid height ? : "
read gw
echo -n "Grid width ? : "
read gh
echo -n "Number of loops ? : "
read lo
echo -n "Use apple corer ? (no(n) OR /north/east/south/west/center)  : "
read ac
#calculate no of frames to move to frames gw x gh
gwgh=$(($gw * $gh))
echo $gwgh   
echo -n "Landscape(l),square(s),portrait(p)? : "
read lsp           
#copy originals to $h/originals
cp *.$f $h/originals/
#new stuff should go between here and infinite loop
#infinite loop
lp=0
while [ $lp -lt $lo ]
do
    ((lp++))
echo "Press Ctrl+C to stop..."
#count how many files we have
cd $h
i=$(ls *.$f | wc -l)
echo  $i
#convert everything to specified format or convert then randomise
#randomise yes
echo -n "Randomising "
mogrify -format $t *.$f
find . -maxdepth 1 -name '*.'$t''|while read filename; do echo ${filename}; mv ${filename} ${RANDOM}.$t; done
#crop to 1:1 4:3 or 3:4 depending on lsp before resizing details here https://stackoverflow.com/questions/21262466/imagemagick-how-to-minimally-crop-an-image-to-a-certain-aspect-ratio
if [ $lsp == "s" ] || [ $lsp == "null" ]
          then   
          find . -maxdepth 1 -name '*.'$t''|while read filename; do echo ${filename}; convert ${filename} -gravity center -crop 1:1 swap.$t; mv swap.$t ${filename};done
          elif [ $lsp == "l" ]
           then
           find . -maxdepth 1 -name '*.'$t''|while read filename; do echo ${filename}; convert ${filename} -gravity center -crop 4:3 swap.$t; mv swap.$t ${filename};done
            elif [ $lsp == "p" ]
           then
           find . -maxdepth 1 -name '*.'$t''|while read filename; do echo ${filename}; convert ${filename} -gravity center -crop 3:4 swap.$t; mv swap.$t ${filename};done
        fi
#resize for preffered size grid
#mogrify -resize 600x600! -gravity center -extent 600x600 *.$t
#modify to size depending lsp variable
if [ $lsp == "s" ] || [ $lsp == "null" ]
          then   
          mogrify -resize 800x800! *.$t      
             
           elif [ $lsp == "l" ]
           then
           mogrify -resize 800x600! *.$t
           elif [ $lsp == "p" ]
           then
           mogrify -resize 600x800! *.$t
          
           fi


#mogrify -rotate 90 *.$t
#mogrify -flop *.$t
#loop to make montages $gwgh at a time so as not to exhaust imagemagick cache
while [ $i -gt 0 ]
do
#move gwxgh images to frames
find . -maxdepth 1 -name '*.'$t'' | head -n $gwgh | xargs -d $'\n' mv -t $h/frames/
#move to frames directory
cd $h/frames/
d=$(date +%Y-%m-%d_%H%M%S)
montage *.$t -geometry +3+3 -tile $gwx$gh $d.$t
#move output back to source folder
convert $d.$t $d.$f
mv $d.$f $h/rotator
#decrease counter by gwgh
i=$((i-="$gwgh"))
#tidy up
rm *.$t
cd $h
done
cd $h/rotator

if [ $ac == "n" ] || [ $ac == "null" ]
          then   
          mv *.$f $h       
             
           elif [ $ac == "center" ]
           then
find . -maxdepth 1 -name '*.'$f''|while read filename; do echo ${filename}; convert ${filename} -gravity center -crop 1300x1300+0+0 swap.$f;
 mv swap.$f ${RANDOM}${RANDOM}.$f;done
            elif [ $ac == "north" ]
            then
find . -maxdepth 1 -name '*.'$f''|while read filename; do echo ${filename}; convert ${filename} -gravity north -crop 1300x1300+0+0 swap.$f;
 mv swap.$f ${RANDOM}${RANDOM}.$f;done
            elif [ $ac == "east" ]
            then
find . -maxdepth 1 -name '*.'$f''|while read filename; do echo ${filename}; convert ${filename} -gravity east -crop 1300x1300+0+0 swap.$f;
 mv swap.$f ${RANDOM}${RANDOM}.$f;done
            elif [ $ac == "south" ]
            then
find . -maxdepth 1 -name '*.'$f''|while read filename; do echo ${filename}; convert ${filename} -gravity south -crop 1300x1300+0+0 swap.$f;
 mv swap.$f ${RANDOM}${RANDOM}.$f;done
            elif [ $ac == "west" ]
            then
find . -maxdepth 1 -name '*.'$f''|while read filename; do echo ${filename}; convert ${filename} -gravity west -crop 1300x1300+0+0 swap.$f;
 mv swap.$f ${RANDOM}${RANDOM}.$f;done
 
 
 fi
#mirror vertically
find . -maxdepth 1 -name '*.'$f''|while read filename; do echo ${filename};
convert ${filename} -gravity east -chop 50%x0 output.$f
convert output.$f -flop output2.$f
convert output.$f output2.$f -gravity North +append ${RANDOM}.$f
rm output.$f
rm output2.$f;
done
#mogrify -monochrome *.$f

#uncomment below to create a negative image on each alternate run
#mogrify -negate *.$f
mv *.$f $h
cd $h

# move x no of images to to new folder
new=$(ls *.$f | wc -l)
if (($new > $disin ))
then
dd=$(date +%Y-%m-%d_%H%M%S)
mkdir $h/$dd
find . -maxdepth 1 -name '*.'$f'' | head -n $dis | xargs -d $'\n' mv -t $h/$dd
fi

done

(Below is a modified version for Windows 10 running gitbash with imagemagick installed and on path)

#! /bin/bash
#make directory to hold output
h=$(pwd)
echo $h
#make folder to store originals
mkdir $h/originals
mkdir $h/frames
#make folder to hold output
mkdir rotator
#get formats to use
echo -n "Source image format ? : "
read f
echo -n "Image format to use  ? : "
read t
echo -n "Discard cut in ? : "
read disin
echo -n "No to discard ? : "
read dis
#get grid dimensions
echo -n "Grid height ? : "
read gw
echo -n "Grid width ? : "
read gh
echo -n "Number of loops ? : "
read lo
echo -n "Use apple corer ? (no(n) OR /north/east/south/west/center)  : "
read ac
#calculate no of frames to move to frames gw x gh
gwgh=$(($gw * $gh))
echo $gwgh   
echo -n "Landscape(l),square(s),portrait(p)? : "
read lsp           
#copy originals to $h/originals
cp *.$f $h/originals/
#new stuff should go between here and infinite loop
#infinite loop
lp=0
while [ $lp -lt $lo ]
do
    ((lp++))
echo "Press Ctrl+C to stop..."
#count how many files we have
cd $h
i=$(ls *.$f | wc -l)
echo  $i
#convert everything to specified format or convert then randomise
#randomise yes
echo -n "Randomising "
magick mogrify -format $t *.$f
find . -maxdepth 1 -name '*.'$t''|while read filename; do echo ${filename}; mv ${filename} ${RANDOM}.$t; done
#crop to 1:1 4:3 or 3:4 depending on lsp before resizing details here https://stackoverflow.com/questions/21262466/imagemagick-how-to-minimally-crop-an-image-to-a-certain-aspect-ratio
if [ $lsp == "s" ] || [ $lsp == "null" ]
          then   
          find . -maxdepth 1 -name '*.'$t''|while read filename; do echo ${filename}; magick convert ${filename} -gravity center -crop 1:1 swap.$t; mv swap.$t ${filename};done
          elif [ $lsp == "l" ]
           then
           find . -maxdepth 1 -name '*.'$t''|while read filename; do echo ${filename}; magick convert ${filename} -gravity center -crop 4:3 swap.$t; mv swap.$t ${filename};done
            elif [ $lsp == "p" ]
           then
           find . -maxdepth 1 -name '*.'$t''|while read filename; do echo ${filename}; magick convert ${filename} -gravity center -crop 3:4 swap.$t; mv swap.$t ${filename};done
        fi
#resize for preffered size grid
#mogrify -resize 600x600! -gravity center -extent 600x600 *.$t
#modify to size depending lsp variable
if [ $lsp == "s" ] || [ $lsp == "null" ]
          then   
          magick mogrify -resize 800x800! *.$t      
             
           elif [ $lsp == "l" ]
           then
           magick mogrify -resize 800x600! *.$t
           elif [ $lsp == "p" ]
           then
           magick mogrify -resize 600x800! *.$t
          
           fi


#magick mogrify -rotate 90 *.$t
#magick mogrify -flop *.$t
#loop to make montages $gwgh at a time so as not to exhaust imagemagick cache
while [ $i -gt 0 ]
do
#move gwxgh images to frames
find . -maxdepth 1 -name '*.'$t'' | head -n $gwgh | xargs -d $'\n' mv -t $h/frames/
#move to frames directory
cd $h/frames/
d=$(date +%Y-%m-%d_%H%M%S)
magick montage *.$t -geometry +3+3 -tile $gwx$gh $d.$t
#move output back to source folder
magick convert $d.$t $d.$f
mv $d.$f $h/rotator
#decrease counter by gwgh
i=$((i-="$gwgh"))
#tidy up
rm *.$t
cd $h
done
cd $h/rotator

if [ $ac == "n" ] || [ $ac == "null" ]
          then   
          mv *.$f $h       
             
           elif [ $ac == "center" ]
           then
find . -maxdepth 1 -name '*.'$f''|while read filename; do echo ${filename}; magick convert ${filename} -gravity center -crop 1300x1300+0+0 swap.$f;
 mv swap.$f ${RANDOM}${RANDOM}.$f;done
            elif [ $ac == "north" ]
            then
find . -maxdepth 1 -name '*.'$f''|while read filename; do echo ${filename}; magick convert ${filename} -gravity north -crop 1300x1300+0+0 swap.$f;
 mv swap.$f ${RANDOM}${RANDOM}.$f;done
            elif [ $ac == "east" ]
            then
find . -maxdepth 1 -name '*.'$f''|while read filename; do echo ${filename}; magick convert ${filename} -gravity east -crop 1300x1300+0+0 swap.$f;
 mv swap.$f ${RANDOM}${RANDOM}.$f;done
            elif [ $ac == "south" ]
            then
find . -maxdepth 1 -name '*.'$f''|while read filename; do echo ${filename}; magick convert ${filename} -gravity south -crop 1300x1300+0+0 swap.$f;
 mv swap.$f ${RANDOM}${RANDOM}.$f;done
            elif [ $ac == "west" ]
            then
find . -maxdepth 1 -name '*.'$f''|while read filename; do echo ${filename}; magick convert ${filename} -gravity west -crop 1300x1300+0+0 swap.$f;
 mv swap.$f ${RANDOM}${RANDOM}.$f;done
 
 
 fi
#mirror vertically
find . -maxdepth 1 -name '*.'$f''|while read filename; do echo ${filename};
magick convert ${filename} -gravity east -chop 50%x0 output.$f
magick convert output.$f -flop output2.$f
magick convert output.$f output2.$f -gravity North +append ${RANDOM}.$f
rm output.$f
rm output2.$f;
done
#magick mogrify -monochrome *.$f
magick mogrify -negate *.$f
mv *.$f $h
cd $h

# move x no of images to to new folder
new=$(ls *.$f | wc -l)
if (($new > $disin ))
then
dd=$(date +%Y-%m-%d_%H%M%S)
mkdir $h/$dd
find . -maxdepth 1 -name '*.'$f'' | head -n $dis | xargs -d $'\n' mv -t $h/$dd
fi

done







Monday, 3 July 2023

Gmic and sox script redux.




 I started using Windows 10 again recently (22h2 with all relevant updates) because I'm doing more online stuff again with Format C and pragmatically when talking to  people who are trying to learn glitch art  techniques for the first time most will be using windows ( mac os people you are on your own I just cant be bothered ), I needed to relearn stuff myself so fresh install of Windows 10 , deal with the usual frustrations and on I go.

 Sooooo long story short I discovered that having used gmic cli in Windows 10 previously , installing it via chocolatey so it was available for use via scripts in git-bash that that option was no longer there , no gmic in chocolatey ( to avoid messing around with path) and worse the gmic add on for gimp was now being identified by windows security as a pup plus the cli version I wanted to use couldnt be added to path or even function within git-bash - oh yea I could use cmd , but who wants to go back to the dark ages of dos cli ( unless im using dos but thats a different post altogether - freedos rocks) 

So whats the solution, and I have to admit this post is mainly for me when I next have to use windows 10 ( god I really hope not - its illogical and ridiculous - where is everything stored why cant I use techniques i use on linux in windows the ridiculous cr lf v's lf - why arent we using utf 8 ? why why why - but I digress) 

The solution is simple , download the gmic cli zip file for windows 10, unzip it then go into the folder copy everything then paste all of that into the git bash folder at C:\Program Files\Git\usr\bin , which then allows me to use this shiny new script which is a work in progress so use at your own risk ( oh yes you need to install sox portable via chocolatey for it to work)- what does it do - it sonifies images and optionally applies a gmic xor blend to your images if you want - it can apply sonification or not ( the none option) and gmic or not - the y/n option or neither !! Its a work in progress so if you enter wrong values it prolly wont work as intended - I may or may  not add more features . Inspired by Vedran Gligo's Megaglitchatron script ( find that here - https://gitlab.com/hacklab01/MegaGlitchATron) copy it and post it into notepad++ or similar  save it as whatever name you want to give it with the .sh extension then run it as 'bash whateveryounameit.sh' via git-bash :

#! /bin/bash
#make directory to hold output
h=$(pwd)
echo $h
mkdir $h/frames
mkdir $h/originals
#get input formats
echo -n "Source image format ? : "
read f
#get destination format
echo -n "Image format to use ? : "
read t
#get effect
echo -n "Effect to use ? : "
read fx
#are we using gmic ( after downloading gmic cli zip and placing that in  C:\Program Files\Git\usr\bin )
echo -n "Use gmic y/n ? : "
read yn
cp *.$f $h/originals

find . -maxdepth 1 -name '*.'$f''|while read filename; do echo ${filename};
#get date to rename file
d=$(date +%Y-%m-%d_%H%M%S)

mv ${filename} test.$f
magick mogrify -format $t test.$f
#rm test.$f
#strip header section for windows
#get header
  head -n 3 test.$t > head.$t;
#strip header ( to avoid damaging it)
  sed -b '1d'  test.$t > swap.$t
 
  #copy that to raw file so we can use sox
cp swap.$t frame.raw
 
#apply effect specified by fx variable
 if [ $fx == "echo" ] || [ $fx == "null" ]
          then
           effect="echos 0.8 0.7 700 0.25 900 0.3 norm"
        elif [ $fx == "reverb" ]
          then
           effect="gain -3 pad 2 8 reverb"
        elif [ $fx == "hilbert" ]
          then
           effect="hilbert -n 5001"
        elif [ $fx == "phaser" ]
          then
           effect="phaser 0.8 0.74 3 0.7 0.5"
        elif [ $fx == "flanger" ]
          then
           effect="flanger 0 2 0 71 0.5 25 lin"
        elif [ $fx == "overdrive" ]
          then
           effect="overdrive 17"   
        elif [ $fx == "none" ]
          then
           effect=""
        fi
#add the effect

sox -r 482170 -e u-law frame.raw frame2.raw $effect
    #try or add these
    #"bass 5"
    #"echo 0.8 0.88 60 0.4"
    #"flanger 0 2 0 71 0.5 25 lin"
    #"hilbert -n 5001"
    #"loudness 6"
    #"norm 90"
    #"overdrive 17"
    #"phaser 0.8 0.74 3 0.7 0.5"
    #"phaser 0.8 0.74 3 0.4 0.5"
    #"pitch 2"
    #"riaa"
    #"sinc 20-4k"
    #"vol 10"

cp frame2.raw swap.$t;
cat head.$t swap.$t > test.$t;

if [ $yn == "n" ] || [ $yn == "null" ]
          then
              magick convert test.$t  $h/frames/$d.$f
           elif [ $yn == "y" ]
          then
            gmic test.$f  test.$t -blend xor -o $h/frames/$d.$f;
        rm test.$f
        fi
#if using displacement comment out line below
#cat head.$t swap.$t > test.$t;
#magick convert test.$t  $h/frames/$d.$f
#mv test.$t $h/frames/$d.$t

rm head.$t
rm test.$f
rm test.$t
rm swap.$t
rm frame.raw
rm frame2.raw

done




 


Saturday, 3 June 2023

3gifomaticwin.sh

 This is a script for windows ( using git-bash terminal and with imagemagick installed) to glitch images in batches of 3 and then makes those images into a single gif - it  copies the original source files into a folder called originals to keep them safe, then moves each batch of three files into the frames folder , glitches them then creates a gif from them then dletes the original images - it does this until images in directory where script is running from are gone !! A work in progress use at your peril .

 

#! /bin/bash
#make directory to hold output
h=$(pwd)
echo $h
mkdir $h/frames
mkdir $h/originals
echo -n "Source image format ? : "
read f
cp *.$f $h/originals/
i=$(ls *.$f | wc -l)

echo $i
echo -n "Image format to use  ? : "
read t
#for loop should go here

while [ $i -gt 0 ]
do
d=$(date +%Y-%m-%d_%H%M%S)
#move three files to $h/frames with find
find . -maxdepth 1 -name '*.'$f'' | head -n 3 | xargs -d $'\n' mv -t $h/frames/
cd $h/frames/

 
magick mogrify -format $t *.$f
find . -type f -name '*.'$t''|while read filename; do echo ${filename};
#do the random number thing
 #generate no from 1 to 16
sugar1=$(( $RANDOM % 16 + 1 ))
sugar3=$(( $RANDOM % 16 + 1 ))
sugar2=$(( $RANDOM % 16 + 2 ))
sugar4=$(( $RANDOM % 16 + 2 ))
#convert to hex
from=$(printf '%x\n' $sugar1)
to=$(printf '%x\n' $sugar2)
from2=$(printf '%x\n' $sugar3)
to2=$(printf '%x\n' $sugar4)

magick convert -resize 640x640\! ${filename} test.$t
xxd -p test.$t| sed -b '5,$s/'"$from""$from2"/"$to""$to2"'/g' | xxd -p -r > ${filename};
done
magick convert -delay 20 -loop 0 *.$t $d.gif
rm *.$f
rm *.$t
cd $h
i=$((i-=3))
#cd $h/frames/
done




Thursday, 11 May 2023

Burner - video and scripts

 

Two ffplay windows generating feedback via two cli scripts plus an extra script to keep the mouse pointer present. 


First script is simpleish - 

ffplay -f x11grab -follow_mouse centered -framerate 23 -vf "rotate=-1.23" -vf vflip -video_size 640x640 -i :0.0
 

Second script is slightly more complex - 

ffmpeg -f x11grab -follow_mouse centered -framerate 23 -video_size 640x640 -i :0.0 -f x11grab -follow_mouse centered -framerate 23 -video_size 640x640 -i :0.0 -lavfi '[1]split[x][y],[0][x][y]displace' -f rawvideo -pix_fmt yuv420p - | ffplay -f rawvideo -pix_fmt yuv420p -vf "rotate=1.23" -s 640x640 -


The most complex script is the one to focus the mouse and keep it awake and move it slightly every so often - run as a bash script from the command line -

echo "Press CTRL+C to stop…"
sleep 10
eval $(xdotool getmouselocation --shell)
echo $X,$Y
while :
do

xdotool mousemove $X $Y
sleep 5
xdotool mousemove_relative -- 0 -5
sleep 2
xdotool mousemove_relative -- 5 -5
sleep 2
xdotool mousemove_relative 0 5
sleep 2
xdotool mousemove_relative -- -5 5

#list for user change of mouse position

xdotool click 5
EXIT_CODE=$?
if [ $EXIT_CODE -eq 0 ]; then
eval $(xdotool getmouselocation --shell)
echo $X,$Y
fi
done


For topicality here is a chatgpt explanation of the second ffmpeg script.I originally fed the script in and asked it to suggest or add different filters and it just regurgitated the original script I'd just asked it to add too, but the explanation is pretty spot on I do love stochastic parrots). Maybe bard will do a better job!!

'Here's a breakdown of the filters used in this script:

    Input: -f x11grab -follow_mouse centered -framerate 23 -video_size 640x640 -i :0.0
    This sets up the first x11grab input for capturing the screen at a framerate of 23, with a video size of 640x640 pixels. The follow_mouse centered option captures the region around the mouse cursor and centers it in the output.

    Input: -f x11grab -follow_mouse centered -framerate 23 -video_size 640x640 -i :0.0
    This sets up the second x11grab input, similar to the first one.

    Filter: -lavfi '[1]split[x][y];[0][x][y]displace'
    This filter splits the second input into two streams ([x][y]) and performs the displace filter on the first input using the two streams. The split filter is used to duplicate the second input stream, so it can be used in both the [x] and [y] parts of the displace filter.

    Filter: -vf "rotate=1.23"
    This filter applies a rotation transformation to the video frames. The 1.23 value represents the rotation angle in radians.

    Output: -f rawvideo -pix_fmt yuv420p -
    This sets up the output format as raw video with YUV420 pixel format and pipes it to the next command.

    Player: | ffplay -f rawvideo -pix_fmt yuv420p -s 640x640 -
    This pipes the raw video output to ffplay for playback. The -s 640x640 option specifies the output display size as 640x640 pixels.

Feel free to adjust the parameters or add more filters as per your requirements.


I've also experimented with using the mandelbrot filter in place of one of the x11grab inputs ie replacing this -f x11grab -follow_mouse centered -framerate 23 -video_size 640x640 -i :0.0 with this -f lavfi -i mandelbrot=s=640x640 -framerate 23 which will give me this :

 


so there is a lot of room for variation and exploration within this space.



Wednesday, 26 April 2023

Four or five windows.

 

Ever had the need to have five or six ffplay windows running on screen at the same time and in specified places? Well after much reading of a manual page and trial and error for placement I came up with this script on PureOS linux. I've migrated most of my boxes over to fully fsf approved os's now. More info on PureOS here https://www.pureos.net/ and list of FSF approved Linux distros here https://www.gnu.org/distros/free-distros.html

Its taken a while for me to get to this stage and I had to abandon the idea of using a non systemd based distro like Gnuinos and I really don't have the  time to install Parabola which though good can be a little haphazard and no longer has an up to date Live Lxde version which for most people is the easiest way of running and installing ( I've installed from both the live lxde version and the cli installation version and the cli install is just antiquated and painful ) so PureOS it is . I had tried Trisquel  but as great as it is it doesnt allow for installing python3-pip without workarounds, I get the argument that python3-pip is problematic but as PureOS allows me to install it PureOS it is . 

Below is the script for opening multiple windows on a linux system running PureOS ( though it should work in other linux distros with a recent ffmpeg installed)  on ICEWM - adjust window size and position for your screen size - this is for 1366x768)

#! /bin/bash
#./background.sh &
ffplay -f x11grab -follow_mouse centered -framerate 5 -video_size 1280x720 -i :0.0 &
# top left hand corner
ffplay -left 0 -top 0 -f x11grab -follow_mouse centered -framerate 5 -video_size 320x288 -i :0.0 &
# top right hand corner
ffplay -left 1035 -top 0 -f x11grab -follow_mouse centered -framerate 5 -video_size 320x288 -i :0.0 &
# bottom left hand corner above toolbar
ffplay -left 0 -top 420 -f x11grab -follow_mouse centered -framerate 5 -video_size 320x288 -i :0.0 &
# bottom right corner
ffplay -left 1035 -top 420 -f x11grab -follow_mouse centered -framerate 5 -video_size 320x288 -i :0.0 &
# centre large 640x480
#ffplay -f x11grab -follow_mouse centered -framerate 5 -video_size 640x480 -i :0.0 &
# centre small
ffplay -f x11grab -follow_mouse centered -framerate 5 -video_size 320x288 -i :0.0

Saturday, 21 January 2023

Making glitch art on chromebooks/chromeosflex




Running glic in processing from linux subsystem on chromeosflex
still capture via chromeosflex screencapture utility.



I got my first Chromebook back in 2018. A lot of what I was doing was online and for that they are great, it was one of the first Chromebooks which could run some android apps and also could run the sub-system for Linux.  What I really bought that Chromebook for was to convert it into a cheap Linux notebook by reflashing the bios using the methods laid out by mrchromeboxtech ( https://github.com/MrChromebox). I'd previously experimented with Chromium-os, the open source version of Chromeos that you can run on any computer and then Neverware cloudready. But really I just wanted a cheap, well  built laptop that would run a full Linux distro with a good level of hardware compatibility (something Linux still struggles with) and so I converted that laptop into a Linux laptop, and thought nothing more about Chromeos other than an interesting os that wasn't really up to what I wanted to do with it, great for secure browsing and security in general, but not for me.

Chromeos itself is based on Linux and stupidly secure  and almost idiot proof it doesn't take much maintenance. Notice that Chromeos is based on Linux, Gentoo if I recall, this is where it gets interesting for me. Google bought up Neverware and now supports and develops cloudready as a free downloadable and installable os. You literally just install the chromebook recovery tool in Chrome browser run it and insert a usb stick and it it does all the rest of writing to the usb stick and creating the install medium for you .

 One of the frustrations of using Linux is that there are all these wonderful tools available and methods that I can use to make my work but these either don't translate to windows well even when using git-bash terminal and a full open source tool set ( see previous posts on Windows 10)   or people just find linux too complicated to install and once installed have problems with hardware compatability ie wifi not working would be the main one or just too difficult to set up and use because they have a windows mindset . So if half of the problem of using the tools I use and trying to explain or teach them to people is installation of an os and then unfamiliarity with an environment and it not connecting to wifi or not running screen resolution correctly because its fully libre or you have to enable the right repository ( ie non-free in Debian etc ) finding Explaining computers video on you-tube ( he has a great channel go and subscribe!! https://www.youtube.com/@ExplainingComputers ) about Googles  update of cloudready, chromeos-flex, was an eye opener watch it here, it explains everything way better than I can https://www.youtube.com/watch?v=AFAg1FkGgMM&t=588s and the next video which explains how to enable the linux subsystem and installing linux apps and sharing between chromosflex and the linux subsystem https://www.youtube.com/watch?v=AsWgzH3OzYY&t=48s

It was this video that gave me the hint that maybe there was a way of both introducing glitch art techniques to a wider audience, both those who wanted to install a linux based distro but were having problems getting a system up and running and those who might only have because of budget a chromebook to work with and also for reusing older computers ( chromeosflex) or taking advantage of the number of chromebooks floating around after the Pandemic which people were selling off or were being cost cut in shops due to lack of demand. 

This is by way of an introduction to my project of making glitch art on chromeosflex/chromebooks , as what works on chromeosflex will also run on a chromebook. 

To start off with I'm running chromeosflex on a Lenovo Thinkpad edge 535 from 2012 ( 11 years old!!) ( Amd A8 4500 m apu ) with 16gb of ddr3 ram and a 250gb ssd , everything else is stock  which cost 150 euros secondhand. I've installed the subsystem for Linux which runs in an lxc container and allowed it to share with chromeosflex . And that's it. Oh yes ive installed ffmpeg etc, my usual tools and am running through what works and what doesn't , there will be more later but for now here's a peak of what Im doing. This is a standard hex edit of a film, Haunted castle, downloaded from archive.org re-encoded from h264 to xvid using ffmpeg then live hex edited using one of my scripts and captured using chromosflex's screencapture program ( which handily uses webm for capture ) .



Open source software: A realistic and pragmatic approach

Open source software: A realistic and pragmatic approach Glitch art, more than most disciplines, asks questions of the software and hardware...