# How do I change the size of an imported picture in an animation?

My code right now plots a function, and animates an image moving along the curve of the function. I want to reduce the size of the image for this animation but I can't figure out how. If I try to change

image = Import["image.png"]


to

image = Import["image.png",ImageSize -> Tiny]


it just makes the image blurry in the animation. This is the animation code:

Animate[Plot[{f[z]}, {z, 0, 50},
PlotRange -> {{0, 50}, {0, 10}},
Epilog -> Inset[image, {x, f[x]}]], {x,
0, 30}]


Does anyone know how to fix this?

• Just set the image size to a somewhat larger value. Commented Feb 18, 2015 at 3:13
• Welcome to Mathematica.SE! I suggest that: 1) You take the introductory Tour now! 2) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! 3) As you receive help, try to give it too, by answering questions in your area of expertise. Commented Feb 18, 2015 at 3:20
• Although this is dealing with an image, the actual focus lies on the Inset, which is discussed here:Scale Insetted Characters to Plot
– Jens
Commented Feb 18, 2015 at 4:33
• @Jens I think the selected duplicate is poor. Chat link: chat.stackexchange.com/transcript/message/20126893#20126893 Commented Feb 18, 2015 at 16:00
• Possible duplicate: (73838). Related: (59235), (73522) Commented Feb 18, 2015 at 17:07

Use the fourth parameter of Inset:

f = Sin[#] + 5 &;
image = ExampleData[{"TestImage", "Lena"}];

Animate[Plot[{f[z]}, {z, 0, 50}, PlotRange -> {{0, 50}, {0, 10}},
Epilog -> Inset[image, {x, f[x]}, Automatic, 10]], {x, 0, 30}]


You can also use Show with the option ImageSize:

image = Show[ExampleData[{"TestImage", "Lena"}], ImageSize -> 40];
f = 5 + Sin[#] + Sin[Sqrt[2] #] &;

Animate[Plot[{f[z]}, {z, 0, 50}, PlotRange -> {{0, 50}, {0, 10}},
Epilog -> Inset[image, {x, f[x]}]], {x, 0, 50}]