I'm getting "Bad image data." when using the Batch image annotation offline feature for Image Properties Detection on Google Cloud Vision when the image extension is .webp.
Now according to the documentation, the .webp extension is supported, and indeed when I tried the regular single image synchronous request for the same image it return results normally, so this seems to be an issue with the batch asynchronous feature. Is there a way to get around this?
Sample code:
vision_client = vision.ImageAnnotatorClient()
image = vision.Image()
storage_client = storage.Client("your-GCP-project-here")
base_gs_url = 'path-to-store-image-on-GCS'
url = 'gs://platform-storage-prod/image/f32d82295d744974b15ecfbcba7eb707/73a2d4f550b04fc3a1b097cc3a9b9428.webp' # doesn't work
source = {'image_uri': url}
image = {'source': source}
features = [{'type_': vision.Feature.Type.IMAGE_PROPERTIES}]
requests = [{'image': image, 'features': features}]
output_folder = base_gs_url + uuid.uuid4().hex + '/'
gcs_destination = {'uri': output_folder}
batch_size = 100
output_config = {'gcs_destination': gcs_destination, 'batch_size': batch_size}
operation = vision_client.async_batch_annotate_images(requests=requests, output_config=output_config)
response = operation.result(90)
Results will be in the .json file created at the specified path.