Base 64 encoding issue

203 views
Skip to first unread message

aditi singhal

unread,
Mar 1, 2022, 2:58:16 AM3/1/22
to cloud-vision-discuss
Hello everyone,
I am testing the google vision api for ocr using postman for a local image. Passing the request body as
{
  "requests": [
    {
      "features": [
        {
          "type": "TEXT_DETECTION"
        }
      ],
        "image": {
"content": "value obtained from online image to base64 converter"
            }
    }
  ]
}

After sending request, I am getting 400 Bad request, with message also containing
"description": "Invalid value at 'requests[0].image.content' (TYPE_BYTES), Base64 decoding failed for.....
I think I am not putting base64 string in a correct format, can someone please help me out with the correct way.
Thanks

Kevin (Google Cloud Platform Support)

unread,
Mar 4, 2022, 10:08:35 AM3/4/22
to cloud-vision-discuss

Hello,

I suggest you to use one of these options in the Cloud Shell of your project's console and copy/paste the content.
EG:
base64 input.jpg (to output the content in the Shell)
base64 input.jpg > output.txt (to output the content into a txt file)

Kind regards,
Reply all
Reply to author
Forward
0 new messages