Rotate image and crop out black borders

The math behind this solution/implementation is equivalent to this solution of an analagous question, but the formulas are simplified and avoid singularities. This is python code with the same interface as largest_rotated_rect from the other solution, but giving a bigger area in almost all cases (always the proven optimum): def rotatedRectWithMaxArea(w, h, angle): “”” Given … Read more