# How to create breathing wall effect?

I would like to recreate the effect of the one in this video: Breathing walls

This is my first time manipulating images, and because of that, I don't even have a clue where to start.

But I think the way to do this must be transforming the geometry of the image with sine waves, correct me if I'm wrong.

• Take a look at ImageTransformation; – Kuba Jun 4 '14 at 9:56
• The author of those videos wrote about it on his blog, although not with the details required to implement the thing it has a good source that might help someone: here. – C. E. Jun 4 '14 at 10:12
• The link should be this: countyourculture.com/2011/03/19/breathing-wall-visualization – Taiki Jun 4 '14 at 14:15

Here's a way of implementing sinusoidal undulations, updated to write out an animated gif, and to use a smaller image, as suggested by Murta.

img = ImageTake[Import["http://i.stack.imgur.com/XMwRi.jpg"], {200, 500}, {200, 600}];
Export["breathing.gif",
Table[ImageTransformation[img, # + {.004 Sin[4 #[[1]] + p], .005 Sin[5 #[[1]] + p]} &,
Padding -> Black], {p, 0, 2 Pi, 0.3}], "DisplayDurations" -> 0.3]


You can make the animation smoother by replacing 0.3 with 0.1 or smaller and the DisplayDurations 0.3 to 0.1.

• Cool.. With ImageResize the effect get more fluid: img = ImageResize[Import["http://i.stack.imgur.com/XMwRi.jpg"], 400] – Murta Jun 4 '14 at 16:28
img = Import["http://i.stack.imgur.com/8Pgul.gif"];
image = img[[3]];

gr = Graphics[{EdgeForm[Directive[Thickness[.1], Black]],
FaceForm[Opacity[0]], Rectangle[{0.1, 0.1}, {.9, .9}]}, ImageSize -> 400];

Animate[
Overlay[{
ParametricPlot3D[{x , y , 1 + .2 ( Cos[ t y + (1 - t) x] )},
{x, -Pi, Pi}, {y, -Pi, Pi},
Mesh -> False, PerformanceGoal -> "Quality", Boxed -> False,
Axes -> False, ImageSize -> 400,
Lighting-> "Neutral", (*thanks: Olexandr R. *)
PlotStyle -> Texture[image], ViewPoint -> Top], gr},
Alignment -> Center],
{t, 0, 1}, AnimationRunning -> False, AnimationRate -> .5]


• Needs Lighting -> "Neutral". Otherwise it's the breathing, oddly pinkish, color changing wall. But a definite +1 for a simple and effective approach to producing the undulations. – Oleksandr R. Jun 7 '14 at 0:24
• @OleksandrR. thank you - excellent point. – kglr Jun 7 '14 at 0:35