You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried countless combinations, but to no avail. I also understand, that the image should be base64 encoded. However, whatever I try, I end up with the following error message.
An error occurred (InvalidImageFormatException) when calling the DetectLabels
operation: Invalid image encoding
It seems that the aws-cli takes the input "blob" you give it, and base64-encodes it again. The problem is, it doesn't in fact treat the input as a blob. It treats it as a string and tries to interpret it as utf8, so you can't actually pass a blob unless by coincidence you happen to be in possession of a blob that just happens to be comprised of entirely valid utf8 characters. Even if you pass JSON, it still encodes the Bytes value to base64.
As a consequence, the only option is to upload the image to S3 first, and then refer to it by using the S3Object property. However this is not always desired and the lack of "Bytes=blob" support seems to be in contrast to the documentation and build-in help texts.
This is not currently possible due to the way that the CLI exposes these input. I'm going to file this as an enhancement to this API to allow passing bytes directory to the command. In the mean time you'll need to use the S3 work around.
Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.
According to the documentation, one can pass image bytes to a Rekognition API operation by using the
Bytes
property in the--image
option:I tried countless combinations, but to no avail. I also understand, that the image should be base64 encoded. However, whatever I try, I end up with the following error message.
It seems that the aws-cli takes the input "blob" you give it, and base64-encodes it again. The problem is, it doesn't in fact treat the input as a blob. It treats it as a string and tries to interpret it as utf8, so you can't actually pass a blob unless by coincidence you happen to be in possession of a blob that just happens to be comprised of entirely valid utf8 characters. Even if you pass JSON, it still encodes the Bytes value to base64.
As a consequence, the only option is to upload the image to S3 first, and then refer to it by using the
S3Object
property. However this is not always desired and the lack of"Bytes=blob"
support seems to be in contrast to the documentation and build-in help texts.System/software used:
aws-cli/1.11.175 Python/2.7.13 Linux/4.8.0-2-amd64 botocore/1.7.33
The text was updated successfully, but these errors were encountered: