I am trying to find a way to turn a circle into segments in Javascript and then download the resulting sectors in image files that are sector-shaped. However, I am unsure how to make sectors from an image and download the resulting sector without any background (I do not want to create a square image and instead want to make a sector-shaped image). I tried cropping images with HTML Canvas (see here for the cropping method I used), but I could not find a way to cut the image into a sector instead of a rectangle and download the image as a sector instead of a rectangle. How should I go about programming this problem? Here is an example of what I want to do (I used photoshop):
Given this circular image, I want to cut it into four equally-sized sectors programmatically: 1, 2, 3, 4.