score:0

1/ to change real value to integer, you can use :

var intvalue = Math.floor( floatvalue );
var intvalue = Math.ceil( floatvalue ); 
var intvalue = Math.round( floatvalue );

2/ for deformed image: try Math.abs(val);


Related Query

More Query from same tag