The polygon points along with the uncut, original image are sent by client to the server.
Is there a way that I can clip (crop) the original image along these point
I did this code to clip an area of an image defined by a polygon.
from PIL import Image, ImageDraw
original = Image.open("original.jpg")
xy = [(100,100),(1000,100),(1000,800),(100,800)]
mask = Image.new("L", original.size, 0)
draw = ImageDraw.Draw(mask)
draw.polygon(xy, fill=255, outline=None)
black = Image.new("L", original.size, 0)
result = Image.composite(original, black, mask)
result.save("result.jpg")