Message Boards Message Boards

0
|
3557 Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

[Solved] Using ImageTrim with a Disk for Masking

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

POSTED BY: John Cromwell
2 Replies

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

POSTED BY: John Cromwell
Posted 3 years ago

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 to do that. Using the image provided

RemoveBackground[img, {Black, .01}]

enter image description here

POSTED BY: Rohit Namjoshi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract