serverless-image-handler icon indicating copy to clipboard operation
serverless-image-handler copied to clipboard

Smart Cropping doesn't work on V4

Open abalsekar opened this issue 7 years ago • 3 comments

Smart cropping fails with Sharp. Using the demo console to produce this JSON request. { "bucket": "my-image-bucket", "key": "my-image-number.jpg", "edits": { "resize": { "width": 100, "height": 100, "fit": "inside" }, "smartCrop": { "faceIndex": 100 } } }

abalsekar avatar Jul 25 '19 09:07 abalsekar

Hey @abalsekar, it's possible that your FaceIndex is out of range and is throwing an error. Recommend checking CloudWatch logs to confirm this but we've added a feature request (#133) to make Smart Cropping fail more gracefully (aka return the original image when the face index is out of range or no faces are detected at all by Rekognition). Hope this helps!

hayesry avatar Aug 02 '19 14:08 hayesry

Also, a potential limitation might be that Rekognition only returns a zero-based array for the first 100 faces detected in an image. So the maximum might be 99 instead of 100 in this particular case.

hayesry avatar Aug 02 '19 14:08 hayesry

We've fixed these issues with smart cropping in v5.2.0.

G-Lenz avatar Jan 29 '21 19:01 G-Lenz