-1

The documentation here https://cloud.google.com/vision/docs/supported-files states PDF & TIFF are supported. Using the Node.js client library I get an error response code:3 & message:'Bad image data.' for TIFFs and PDFs but all other file types are accepted and labeled. I'm using local files not cloud storage e.g.

const [result] = await client.labelDetection('./test.pdf');

Neither of the "Try it!" demo pages will allow upload of TIFF or PDF either.

DaveL
  • 11
  • 2
  • So as Felix details below, label detection for TIFF & PDF is supported, but only using the "Online small batch" method. An alternative is to simply convert TIFF & PDF to a fully supported format instead. Large files can also be downsized at the same time and in my situation conversion and upload was quicker than uploading the original anyway. – DaveL Jul 22 '21 at 15:28

1 Answers1

0

While the Vision API supports PDF and TIFF formats, there are some considerations you should be mindful of. Quoting the official documentation linked:

  1. Currently DOCUMENT_TEXT_DETECTION and TEXT_DETECTION are the only feature types available for offline (asynchronous) large batch file (PDF/TIFF) annotation.

Alternatively,

  1. Online small batch annotation is available for all Vision features.

Bear in mind that small batch is limited to files not larger than 5 PDF/TIFF pages.
You can find examples of how to implement this in Node.js in the links above.

Additionally, I was able to successfully run this Try it demo.

Felix L.
  • 222
  • 1
  • 11