1
$\begingroup$

I am planning to use Mathematica for a presentation. In one of the slides I need to place a jpeg file side by side to a mov file.

Row[{ImageResize[Import["compressor.jpeg"], 1500], Import["kiwi.mov","Animation"]}]

There is a huge difference in size between the jpeg figure and the mov file. I could click on the jpeg file and change its size but the outcome is not nice (too big for showing in just one slide).

Is there a set of options (commands or a complete different solution) that I can use to have both jpeg and mov dimensions set to a specific size? I could not figure out how to change the size of the Animation frame. I can click and change the size of the movie itself but not the size of the frame.

Many thanks.

$\endgroup$
  • $\begingroup$ The documentation mentions that Animate takes the same options as Manipulate; among those there is a ContentSize option that you could use to change the size of the contents of your Animate pane. $\endgroup$ – MarcoB May 23 '15 at 20:03
  • $\begingroup$ @MarcoB. Many thanks but I am not sure how to set ContentSize within Import. Import takes only 2 parameters. $\endgroup$ – Ed Mendes May 23 '15 at 20:14
2
$\begingroup$

You could import each frame of your movie as a separate image, then use ListAnimate on this list to generate an animation on which you would then have full control.

I am going to generate a static image and a test movie to play with:

staticimage = Rasterize@Plot[Sin[x], {x, -Pi, Pi}, AspectRatio -> 1, ImageSize -> Medium];
Table[Rasterize@Plot[Sin[i x], {x, -Pi, Pi}, AspectRatio -> 1], {i, 1, 5, 0.5}];
Export["test.mov", %]

Now I use Import to obtain a list of frames from the test movie. You already know how to import the image you need, so I will just assume that the image has been stored in staticimage for the purposes of this toy example. I then set the dimensions of the ListAnimate output to those of the static image.

GraphicsRow[{
  staticimage,
  ListAnimate[
   Import["test.mov", "ImageList"],
   ImageSize -> ImageDimensions[staticimage]
  ]
}]

animated plot

ListAnimate gives you a lot of control over the resulting animation: you can set the framerate, the duration, whether it will continue indefinitely, etc. It is worth your time to take a look at its documentation.

$\endgroup$
  • $\begingroup$ Unfortunately it did not work with the mov file I have. ListAnimate works separately but not with the static image. $\endgroup$ – Ed Mendes May 23 '15 at 23:00
  • $\begingroup$ @EdMendes what exactly went wrong? $\endgroup$ – MarcoB May 23 '15 at 23:01
  • $\begingroup$ I can see the image and a box with a black strip on it. No animation though. The movie is there but it has not been resized so that is the reason I can only see a very tiny strip of it. $\endgroup$ – Ed Mendes May 23 '15 at 23:08
  • $\begingroup$ @EdMendes Do you know the absolute sizes of the image and movie? I'd like to see if I can reproduce the problem on this end with the toy example I have already in place. $\endgroup$ – MarcoB May 23 '15 at 23:43
  • $\begingroup$ Unfortunately not. Would Import with imageSize do? If so, sizes are: {1280, 960} for the picture and {588, 632} for the movie. Many thanks. $\endgroup$ – Ed Mendes May 24 '15 at 1:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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