# Circular crop: extract non rectangular parts of an image

I want to extract a part of an image. For example, let's start with something like the following image:

I would like to apply some image processing to get this result:

I have tried to manipulate Graphics[Disk] and the image using ImageAdd but it looks like the Graphics[Disk] is a box that contains a disk, so adding the Mathematica logo image to the Disk outputs a white box.

Here is one way:

extractAnnulus[image_, {r1_, r2_}] := Module[{mask},
White, Disk[{0, 0}, r2],
Black, Disk[{0, 0}, r1]
},
PlotRange -> 1,
Background -> Black,
ImageSize -> ImageDimensions[image]
];


• @JMarc Yes, I set PlotRange to one which means that zero is the top/left edges of the mask (a graphics object), and 1 is the bottom/right edges of the mask. i.e. I create a coordinate system where all coordinates are between 0 and 1. Then I specify, using ImageSize, that the corresponding image of this graphics object should have the same size as the image we are putting the mask over. This is actually useful to understand, because this approach breaks if the aspect ratio of the image is not square, then the aspect ratio has to be taken into account when creating the mask. – C. E. Sep 30 '15 at 10:29