How to achieve trippy breathing effect (visual drifting) on static photo
You can achieve an effect like this with a couple of distortion filters from most video editing or motion graphics packages. For example in FCPX/Motion, you could apply a couple of Bulge distortion filters to the upper right and lower left and adjust the scale and radius as appropriate.

In terms of implementing it yourself, I agree that it's a question for StackOverflow (once you've attempted to write it yourself). The algorithm is fairly straightforward. For all the pixels within the radius, apply a mapping function along the vector from the center to the current point. For example (in pseudo code):

distort (vec2 center, float radius, float amount)
{
    for (each pixel in the image)
    {
        vec2 dir = pixel.coord - center;
        float dist = dir.length()
        if (dist &gt;= radius)
        {
            outPixel = pixel;
        }
        else
        {
            float percent = dist / radius;
            float newPos = pow(percent, amount);
            dir = dir / dist;
            vec2 newCoord = dir * newPos * radius;
            outPixel = getPixel(newCoord);
        }
    }
}