Prototyping 5 Feb 2013

From XPUB & Lens-Based wiki

Comparing the analog to the digital via cadavre exquis + imagemagick and some simple file-sharing with netcat.

On paper...

CadavreexquisFED2013-1.png CadavreexquisFED2013-2.png CadavreexquisFED2013-3.png CadavreexquisFED2013-4.png CadavreexquisFED2013-5.png CadavreexquisFED2013-6.png

A script to sound a tone after 60 seconds...

 sleep 60; play -n synth 0.5 sin 800


Drawing

http://www.imagemagick.org/Usage/draw/

Start by selecting a single imagemagick operation, and test your script.

Passing

Passing an image:

  • IP Addresses

Run the woof script, note the web address it gives. This is a URL with your (dynamically assigned) IP address (the four numbers) plus a port number (after the colon) which be default is 8080.

Listen for a file

nc -l -p [LocalPort] > [outfile]

Listen on [LocalPort], store results in [outfile]

Push a file

nc -w3 [TargetIPaddr] [port] < [infile]

Push [infile] to [TargetIPaddr] on [port]

Afternoon: Digital Cadavre Exquis

slice

Slice up an image, vertically:

convert olifant.jpg -crop 20x +repage +adjoin olifant_20x_%d.jpg

And glue it back together, almost perfect:

Olifantje.jpg

merge

convert -append /file_split*.png /file_vertical.png 
convert +append /file_split*.png /file_horizontal.png

gif

convert +repage file* outputfile_overlapping.gif
convert +repage file* outputfile+coordinates.gif


slice an image up in x number of slices

#!/bin/bash
#to run type: "bash *name of script* *path to source image* *amount of slices*"
#example: bash strip.sh /img.jpg 10

#make variable called 'width' which takes the width of the image($1)
#make variable called 'n' which is the amount of slices($2)
#make variable called strp which is the division of the width of the image by the amount of required slices
#slice the $1 image into images called strip*.jpg that are $strp wide 

width=$(identify -format %w $1)
n=$2
strp=$((width/n))
convert $1 -crop $strp +repage +adjoin strips%d.jpg