Skip to content

Instantly share code, notes, and snippets.

@gijs
Forked from leegao/Full.js
Created December 10, 2010 13:51
Show Gist options
  • Save gijs/736217 to your computer and use it in GitHub Desktop.
Save gijs/736217 to your computer and use it in GitHub Desktop.
/*
* 1. Find a picture, open it, and disable your popup blocker
* 2. Enter the following into your address bar
* 3. ???
* 4. Profit
*/
javascript:function dr(e){h=e.height;w=e.width;var d=document.createElement("canvas");d.width=w;d.height=h;ct=d.getContext("2d");ct.drawImage(e,0,0);im=ct.getImageData(0,0,w,h);dt=im.data;a=(c=Math.ceil)(w/(z=30));a=2;b=[];str='<p style = "line-height:6px;font-size:6px;padding:0;">';for(j=0;j<c(h/a);j++){for(i=0;i<c(w/a);i++){t=[[],[],[],[]];for(y=j*a;y<(j+1)*a;y++){for(x=i*a;x<(i+1)*a;x++){t[0].push(dt[(pt=y*w*4+x*4)]);t[1].push(dt[pt+1]);t[2].push(dt[pt+2]);t[3].push(dt[pt+3])}}b.push(ls=[(sm=function(f){sg=0;for(id=0;id<f.length;id++){sg+=f[id]==undefined?0:f[id]}sg=c(sg/f.length);return sg>255?255:sg})(t[0]),sm(t[1]),sm(t[2]),sm(t[3])/256]);str+="<span style='background-color:rgba("+ls[0]+","+ls[1]+","+ls[2]+","+ls[3]+")'>&nbsp;&nbsp;&nbsp;</span>"}str+="<br>"}str+="</p>";return str}function dp(f){try{nw=window.open();nw.document.writeln(f)}catch(d){alert(d)}}images=document.images;s="";for(var abc=0;abc<images.length;abc++){if((w=(image=images[abc]).width)>=30&&(h=image.height)>=30){try{s+=dr(image)}catch(err){}}}dp(s);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment