# \[Solved\] Using ImageTrim with a Disk for Masking

**URL:** <https://community.wolfram.com/t/solved-using-imagetrim-with-a-disk-for-masking/16928>\
**Category:** Questions\
**Tags:** image-processing\
**Created:** [October 27, 2020, 12:46pm UTC](https://community.wolfram.com/t/solved-using-imagetrim-with-a-disk-for-masking/16928 "2020-10-27T12:46:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![johncromwell](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/johncromwell/32/3264_2.png) [@johncromwell](https://community.wolfram.com/u/johncromwell)\
**Post date:** [October 27, 2020, 12:46pm UTC](https://community.wolfram.com/t/solved-using-imagetrim-with-a-disk-for-masking/16928/1 "2020-10-27T12:46:25Z")

</div>

I’m trying to crop the image below using a disk-shaped mask. ImageTrim documentation suggests that using a Disk object for masking is supported. However, when I use the following, it trims the image in a square rather than a disk:

`ImageTrim[image, Disk[{375, 375}, 300]]`

I appreciate any suggestions on how to crop the image to a circle.

 ![image.jpeg](https://global.discourse-cdn.com/wolfram/original/3X/9/7/97c2dc233e5c92089a3a3f1dabc644d841d48eb9.jpeg)

---

<div class="post-metadata">

**Author:** ![rohitnamjoshi](https://avatars.discourse-cdn.com/v4/letter/r/f1d935/32.png) [@rohitnamjoshi](https://community.wolfram.com/u/rohitnamjoshi)\
**Post date:** [October 27, 2020, 1:50pm UTC](https://community.wolfram.com/t/solved-using-imagetrim-with-a-disk-for-masking/16928/2 "2020-10-27T13:50:35Z")

</div>

Hi John,

Images are always rectangular. Perhaps what you want is to replace the dark areas around the disk with an alpha channel that will make it transparent. You can use [`RemoveBackground`](https://reference.wolfram.com/language/ref/RemoveBackground.html) to do that. Using the image provided

```
RemoveBackground[img, {Black, .01}]

```

 ![4001plot.jpg](https://global.discourse-cdn.com/wolfram/original/2X/9/90839f064afa28d000f2ad9035da740bbe1bafea.jpeg)

---

<div class="post-metadata">

**Author:** ![johncromwell](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/johncromwell/32/3264_2.png) [@johncromwell](https://community.wolfram.com/u/johncromwell)\
**Post date:** [October 27, 2020, 3:33pm UTC](https://community.wolfram.com/t/solved-using-imagetrim-with-a-disk-for-masking/16928/3 "2020-10-27T15:33:57Z")

</div>

Thanks so much! This is exactly what I was trying to accomplish.  
John

---

<div class="post-metadata">

**Author:** ![coti](https://avatars.discourse-cdn.com/v4/letter/c/35a633/32.png) [@coti](https://community.wolfram.com/u/coti)\
**Post date:** [May 29, 2025, 10:16am UTC](https://community.wolfram.com/t/solved-using-imagetrim-with-a-disk-for-masking/16928/4 "2025-05-29T10:16:01Z")

</div>

I, too, was looking for a solution. Thanks a lot!

José
