question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SmartCrop: You have provided a FaceIndex value that exceeds the length of the zero-based detectedFaces array.

See original GitHub issue

I’m attempting to use the smartCrop option:

edits: {
  smartCrop : true
}

This error is logged in CloudWatch:

{ status: 400,
code: 'SmartCrop::FaceIndexOutOfRange',
message: 'You have provided a FaceIndex value that exceeds the length of the zero-based detectedFaces array. Please specify a value that is in-range.' }

It is failing because of this line. It doesn’t first check if any faces were detected before it starts defining the bounding box. In my opinion, smartCrop should fail gracefully (not crop) if no faces were detected in the image. Would you accept a PR for this, or provide some advisement on how best to implement it?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:23 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
joebernardcommented, Feb 1, 2021

I upgraded to v5.2.0. It returns a 400 error with these settings:

smartCrop: {
  faceIndex: 0,
  padding: 1
}

{“status”:400,“code”:“SmartCrop::PaddingOutOfBounds”,“message”:“The padding value you provided exceeds the boundaries of the original image. Please try choosing a smaller value or applying padding via Sharp for greater specificity.”}

No matter what padding value I try it returns the same error. If no padding is passed it does return a face very closely cropped and not really usable.

1reaction
voneccommented, Nov 13, 2020

can we expect this to be fixed in the next release, waiting for this since July. Also I hope the images will be cached after processing as calls to rekognition are chargeable.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SmartCrop: You have provided a FaceIndex value ... - GitHub
SmartCrop: You have provided a FaceIndex value that exceeds the length of the zero-based detectedFaces array. #133.
Read more >
Smart cropping with Amazon Rekognition - AWS Documentation
Detected faces are indexed in a zero-based array from the largest detected face to the smallest. If this value is not specified, Amazon...
Read more >
exceeds the number of array elements in image processing.
The given code below shows an error that index exceeds the number of array elements. ... is not always the same size, can...
Read more >
Dynamic Media image profiles | Adobe Experience Manager
When uploading images, you can automatically crop the image upon upload by applying an image profile to the folder. ... Smart Crop is...
Read more >
smartcrop - npm
Smartcrop.js implements an algorithm to find good crops for images. It can be used in the browser, in node or via a CLI....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found