4
$\begingroup$

I have a website that supports video background, I've always used static pictures, but would like to change them into looping ken burns style videos where the image's crop slowly drifts along a vector and zooms in/out simultaneously.

Here are two examples of this drifting effect:

enter image description here

$\endgroup$
6
$\begingroup$

Here's a real quick example that does what you're looking for:

Export["test.gif",
   ImageResize[#,100] & /@ 
   Table[ImageTrim[Import["ExampleData/coneflower.jpg"], 
        {{0,0},{m,m}}],{m,100,50,-5}]
, "GIF"]

Here we use ImageResize to set the final image size, and use ImageTrim to pick which section of the image you're zooming into. Exporting a table of images to GIF is the easiest way to get your output file. Of course you will want more iterations for a smoother image, and you can edit the dimensions to get the effect you're looking for.

output

| improve this answer | |
$\endgroup$
5
$\begingroup$

You can change the specific functions and speed etc.of course, but how about something like this?

im1 = ImageReflect[Import["1.jpg"]];
ima = Raster[ImageData[im1], {{-1.5023, -1}, {1.5023, 1}}];
gif = Table[
   Graphics[Scale[Translate[ima, {Sin[a], Sin[Cos[a]]}], Cos[Sin[a]]],
     ImageSize -> Medium, PlotRange -> {{0, 1}, {0, 1}}], {a, 0, 2 Pi,
     0.15}];

enter image description here

| improve this answer | |
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.