I want to make the following animation. The basis is a image, for example Lena's photo. I will place a new layer over this image. This layer has a color, for example black. In this layer there is a recess in the shape of a circle. Through this circle you can see the photo of Lena. I want to move the circle with the visible bottom layer, creating an animation of a part of Lena's head. During this animation, several circles can slide across the screen.

enter image description here

I myself have tried several functions without the desired effect. Does anyone have a suggestion how I can solve this problem?


1 Answer 1


I think the cleanest solution is to use HighlightImage which also has interactive example in the documentation that might be useful to you.

img = ExampleData[{"TestImage", "Peppers"}];
HighlightImage[img, {Transparent, Disk[{170, 350}, 150], 
  Disk[{430, 300}, 75], Disk[{400, 60}, 50]}, {"Remove", Black}]

enter image description here

  • 2
    $\begingroup$ Just in case it isn't clear from Domen's posting, the full (interactive) answer is given in the linked documentation page. ($+1$) $\endgroup$ Commented Jul 13, 2023 at 17:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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