Repository navigation
detectText provide base64 #2123
Description
Activity
Can you show example code that you'd like to work, as well as the error (and how you got it)?
GoogleCloudPlatform/cloud-vision#112
Using nodejs lib and provide file path works fine,but not works for base64 string.
As best as I can tell, he is referencing this code, which is in of itself quite cryptic.
- addedpriority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: questionRequest for information or clarification. Not an issue.Request for information or clarification. Not an issue.
on Mar 22, 2017 Google's example got wrong here for "images" but only one content keys in the payload.
The problem might be the "s".But no suprise,because Google no response to my mail for up to 5 times including GCE and other services for both tech and sales.
Where is the detectText function write in this Repo?Because only find it in the describe and Readme.
Thanks for reply.
Our
detectTextfunction is here: https://github.com/GoogleCloudPlatform/google-cloud-node/blob/a3c455f765822a24d87adb3c2469b5e31b8288f2/packages/vision/src/index.js#L1535 - which as you'll see, is just a wrapper arounddetect()that specifies thetexttype.Your input is fed to
findImages_, a helper function which can take multiple forms of input and figure out how to send them to the API. The first case it handles is for Buffer types, which it will send through as base64.So, I believe we support the feature you're looking for, however, provide the base64 string as a Buffer:
var input = new Buffer(myBase64String, 'base64') vision.detectText(input, ...
Reacted by Matt RognstadPR sent with an addition to the docs to make this more clear: #2145
- added 2 commits that reference this issue
on Feb 26, 2026 - added a commit that references this issue
on Mar 11, 2026 - added a commit that references this issue
on Mar 27, 2026

improve the function to able to read base64.
And improve your error message for more specific.