Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This is cool ... any idea what languages are supported? All I can find in the Google docs is "Vision API supports a broad set of languages."


The HTTP API is relatively simple to work with actually. Here is a quick example on how to work with it in NodeJS:

    var request = require('request')
    
    var file = require('fs').readFileSync('./testimage.png').toString('base64')
    
    var body = {
      requests: {
        image: {
          content: file
        },
        features: [
          {
            type: 'TEXT_DETECTION',
            maxResults: 10
          }
        ]
      }
    }
    
    var url = 'https://vision.googleapis.com/v1/images:annotate\?key\=your_api_key'
    
    request({
      url: url,
      method: 'POST',
      body: JSON.stringify(body)
    }, (err, res, body) => {
      console.log(err)
      console.log(body)
      console.log(JSON.parse(body).responses[0].textAnnotations[0].description)
    })
Basically you want to convert image data into base64, put it in the requests.image.content field and make a POST request and you'll get back the text.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: