Split and shift RGB channels in Python
<p>What I'm trying to do is recreating what is commonly called an "RGB shift" effect, which is very easy to achieve with image manipulation programs. </p>

<p>I imagine I can "split" the channels of the image by either opening the image as a matrix of triples or opening the image three times and every time operate just on one channel, but I wouldn't know how to "offset" the channels when merging them back together (possibly by creating a new image and position each channel's [0,0] pixel in an offsetted position?) and reduce each channel's opacity as to not show just the last channel inserted into the image. </p>

<p>Has anyone tried to do this? Do you know if it is possible? If so, how did you do it?</p>

<p>Thanks everyone in advance! </p>

<p>Per color plane, replace the pixel at <code>(X, Y)</code> by the pixel at <code>(X-1, Y+3)</code>, for example. (Of course your shifts will be different.)</p>

<p>You can do that in-place, taking care to loop by increasing or decreasing coordinate to avoid overwriting.</p>

<p>There is no need to worry about transparency.</p>

python image image-processing rgb