Hacker News new | ask | show | jobs
by jqpabc123 133 days ago
I'm not 100% sure what to do when the ratio can't be complied with

Center the crop on the detected face and use the detected width or height, whichever is smaller.

If no face, just use 50% of the smallest overall dimension (height or width) and adjust the other dimension to match the ratio.

If an available dimension is exceeded, use what is available and adjust the remaining one to match the ratio.

This should always result in a valid crop ratio.

Always allow for user adjustment.