Page 2 of 2

Re: What happens when a channel gets separated?

Posted: 2015-08-27T11:38:18-07:00
by snibgo
Wikipedia shows the same process as IM "-separate":

Code: Select all

for (var i = 0; i < data.length; i += 4) {
    var grayscale = data[i];
    data[i]     = grayscale; // red
    data[i + 1] = grayscale; // green
    data[i + 2] = grayscale; // blue
}

Re: What happens when a channel gets separated?

Posted: 2015-08-27T11:39:19-07:00
by fmw42
OK. So your javascript needs all 3 channels the same. But where do you save the file to disk and in what format?

Re: What happens when a channel gets separated?

Posted: 2015-08-27T12:46:00-07:00
by baxter stockman
I post it back to the canvas and then save it as a png:

Code: Select all

var dataURL = canvas.toDataURL('image/png');

Re: What happens when a channel gets separated?

Posted: 2015-08-27T12:48:55-07:00
by baxter stockman
@snibgo: so does that mean a channel separation is just taking one value and then using the same value for all three channels?

Re: What happens when a channel gets separated?

Posted: 2015-08-27T13:07:32-07:00
by snibgo
Yes.