lib/conversion.js
function (idx) {

		var r = this.getRed(idx),
			g = this.getGreen(idx),
			b = this.getBlue(idx),
			y,
			i,
			q;

		y = this.getLumaAtIndex(idx);
		i = Math.floor((0.595716 * r) - (0.274453 * g) - (0.321263 * b));
		q = Math.floor((0.211456 * r) - (0.522591 * g) + (0.311135 * b));

		y = y < 0 ? 0 : (y > 255 ? 255 : y);
		i = i < 0 ? 0 : (i > 255 ? 255 : i);
		q = q < 0 ? 0 : (q > 255 ? 255 : q);

		return {y: y, i: i, q: q};
	}
function (idx) {

		var r = this.getRed(idx),
			g = this.getGreen(idx),
			b = this.getBlue(idx),
			y,
			i,
			q;

		y = this.getLumaAtIndex(idx);
		i = Math.floor((0.595716 * r) - (0.274453 * g) - (0.321263 * b));
		q = Math.floor((0.211456 * r) - (0.522591 * g) + (0.311135 * b));

		y = y < 0 ? 0 : (y > 255 ? 255 : y);
		i = i < 0 ? 0 : (i > 255 ? 255 : i);
		q = q < 0 ? 0 : (q > 255 ? 255 : q);

		return {y: y, i: i, q: q};
	}
function ( idx ) { var r = this . getRed ( idx ) , g = this . getGreen ( idx ) , b = this . getBlue ( idx ) , y , i , q ; y = this . getLumaAtIndex ( idx ) ; i = Math . floor ( ( 0.595716 * r ) - ( 0.274453 * g ) - ( 0.321263 * b ) ) ; q = Math . floor ( ( 0.211456 * r ) - ( 0.522591 * g ) + ( 0.311135 * b ) ) ; y = y < 0 ? 0 : ( y > 255 ? 255 : y ) ; i = i < 0 ? 0 : ( i > 255 ? 255 : i ) ; q = q < 0 ? 0 : ( q > 255 ? 255 : q ) ; return { y : y , i : i , q : q } ; }
Gets the YIQ-value of a pixel at a specific index
The values for RGB correspond afterwards to YIQ respectively.

@method getYIQAtIndex
@param {int} idx Index of pixel
@return {object} YIQ-value
Gets the YIQ - value of a pixel at a specific index The values for RGB correspond afterwards to YIQ respectively .