Submit
Browse
Anonymous
Login
RSS
SuperCollider Code
Fork Code: JPEG / JPG Glitcher
name
code content
// code found @ "http://uiae.de/?p=110" // based on: http://www.hellocatfood.com/create-jpgs-in-pure-data/ // test with jpeg data here: http://www.ffd8.org/header_remix/?showall=yup ( // make 10 glitched versions of a JPEG 10.do{ |i| // change here the path of the original image and the path to the glithced images var inpath = "/Users/rukano/Desktop/monalisa.jpg"; var outpath = "/Users/rukano/Desktop/monalisa-glitch-%.jpg".format(i); var outfile; var file = File.open(inpath, "rb"); var data = file.length.collect{ file.getInt8 }; // how many bytes to replace 100.do{ var pos = rrand(200, data.size - 10); data[pos] = 256.rand; // data[pos] = (data[pos] + 100.rand2).max(0).min(255); }; // write out the file outfile = File.new(outpath, "wb"); outfile.write(data.as(Int8Array)); outfile.close; "---> wrote %".format(outpath).postln; }; )
code description
This code, based on uiae's blogpost takes a JPG file and replaces some bytes on it to mess up the codec. The result, some funny glitches
use markdown for formating
category tags
comma separated, i.g. "wild, siren" (do not enter default SC class names, please)
ancestor(s)
comma separated identificators, i.g. "1-C,1-1,1-4M,1-x"
Private?
the code will be accessible by direct url and not visible in public activity
signup to submit public code without captcha
comment of change