I’ve to implement an algorithm/program in JS where I can fit many transparent images in a rectangle box in such a way that their non-transparent area should not overlap. An image can be rotated or resize to fit.
I don’t want to put the image in rectangular box because transparent area of two images can intersect.
I’ve found an algorithm which can help to prepare the polygon of non-transparent pixels from an image using canvas. And the other algorithm to find interaction of two polygons. (not tested)