| 293 | } |
| 294 | |
| 295 | async function detectProperties(fileName) { |
| 296 | // [START vision_image_property_detection] |
| 297 | const vision = require('@google-cloud/vision'); |
| 298 | |
| 299 | // Creates a client |
| 300 | const client = new vision.ImageAnnotatorClient(); |
| 301 | |
| 302 | /** |
| 303 | * TODO(developer): Uncomment the following line before running the sample. |
| 304 | */ |
| 305 | // const fileName = 'Local image file, e.g. /path/to/image.png'; |
| 306 | |
| 307 | // Performs property detection on the local file |
| 308 | const [result] = await client.imageProperties(fileName); |
| 309 | const colors = result.imagePropertiesAnnotation.dominantColors.colors; |
| 310 | colors.forEach(color => console.log(color)); |
| 311 | // [END vision_image_property_detection] |
| 312 | } |
| 313 | |
| 314 | async function detectPropertiesGCS(bucketName, fileName) { |
| 315 | // [START vision_image_property_detection_gcs] |