How to stream image / not read into memory?
jstayton opened this issue ยท 3 comments
jstayton commented
Hey ๐๐ป
I'm currently annotating an image with the following code:
const imageBuffer = ...
const client = new vision.ImageAnnotatorClient({ ... })
const [results] = await client.annotateImage({
image: {
content: imageBuffer,
},
features: [...],
})
After scouring through the documentation, I'm not seeing any way to use a stream instead of a buffer, so that the whole image isn't ready into memory. Am I just missing it? Or is it not possible?
Thanks!
kweinmeister commented
Here's an example of specifying a source URI rather than a content buffer. Does that help?
jstayton commented
Hmmm. I guess I could use a stream to upload to Google Cloud Storage (like this example), and then specify the gs
URL like in the example above?
kweinmeister commented
Yes, that would be the best approach, as we currently don't support streaming in this library.