Google cloud vision

From calesthio/generative-media-skills · View interactive version

Google cloud vision is an AI agent skill from the GitHub repository calesthio/generative-media-skills. Use this skill when an agent needs Google Cloud Vision API for still-image understanding: labels, object localization, OCR, document text, SafeSearch, image properties, crop hints, web detection, batch annotation, Cloud Storage based pipelines, confidence evaluation, privacy, quotas, cost, and QA. D

How to use this skill

Skill file

Google Cloud Vision API for still-image understanding

Use Google Cloud Vision when the production task needs structured annotations from still images: general labels, object boxes, text/OCR, dense document text, explicit-content likelihoods, dominant colors, crop suggestions, or web-reference signals. Treat it as a computer-vision annotation service, not as a conversational image reasoner.

Verified on 2026-07-11 against first-party Google Cloud documentation whose Cloud Vision pages were last updated 2026-07-07 unless otherwise noted. Pricing, quotas, endpoints, product lifecycle, supported features, and model behavior are volatile; recheck the linked Google pages before promising a production SLA, budget, data-region commitment, or migration path.

Use and non-use boundaries

Documented fact: Cloud Vision API feature types include TEXT_DETECTION, DOCUMENT_TEXT_DETECTION, LABEL_DETECTION, OBJECT_LOCALIZATION, SAFE_SEARCH_DETECTION, IMAGE_PROPERTIES, CROP_HINTS, and WEB_DETECTION, among other features such as landmarks, logos, and faces. Source: Google Cloud Vision features list, verified 2026-07-11.

Use Cloud Vision for:

Do not use Cloud Vision as the primary tool for:

Feature selection map

Documented facts below are from the Google Cloud Vision feature docs, verified 2026-07-11.

| Need | Request feature | Output to expect | Production notes |

| --- | --- | --- | --- |

| Sparse text in a photo, sign, label, package, screenshot region | TEXT_DETECTION | textAnnotations plus fullTextAnnotation; extracted UTF-8 text, words, bounding boxes | Use for text embedded in broader imagery. Do not force language hints unless the language is known; Google says empty hints usually yield best automatic detection, and wrong hints can hinder results. |

| Dense page, scanned form, document image, handwriting, PDF/TIFF OCR | DOCUMENT_TEXT_DETECTION | fullTextAnnotation hierarchy: Page -> Block -> Paragraph -> Word -> Symbol; dense document structure | Takes precedence if both OCR features are requested. Use Document AI instead when you need structured form parsing, entity extraction, document workflows, or specialized processors. |

| General image tags | LABEL_DETECTION | labelAnnotations with description, score, topicality, and MID | Good for search tags and coarse categorization. Do not treat labels as exhaustive or mutually exclusive taxonomy. |

| Objects with locations | OBJECT_LOCALIZATION | localizedObjectAnnotations with English object names, scores, MIDs, and normalized vertices in [0,1] | Use for bounding-box workflows. Labels are returned in English; translate downstream if needed. |

| Explicit-content prefilter | SAFE_SEARCH_DETECTION | Likelihoods for adult, spoof, medical, violence, and racy: UNKNOWN, VERY_UNLIKELY, UNLIKELY, POSSIBLE, LIKELY, VERY_LIKELY | Design policy thresholds per category. Do not collapse the five categories into one opaque score without documenting why. |

| Dominant colors | IMAGE_PROPERTIES | Dominant RGBA colors, score, pixel fraction | Google says ColorInfo does not carry absolute color-space info; assume sRGB unless your pipeline controls color management. |

| Automated crop suggestions | CROP_HINTS | Crop polygons, confidence, importance fraction; optional aspect ratios | You can supply up to 16 width:height aspect ratios. Crop hints are saliency suggestions, not art direction; check brand, faces, product edges, and text manually or with additional rules. |

| Web context and reverse-image-like signals | WEB_DETECTION | Web entities, full matching images, partial matches, pages with matching images, visually similar images, best-guess labels | Useful for asset triage and context discovery. It is not a license search, provenance guarantee, or fact-checking authority. |

OCR distinctions that matter

Documented fact: TEXT_DETECTION is optimized for sparse areas of text within a larger image. DOCUMENT_TEXT_DETECTION is optimized for dense text, document images, handwriting, and PDF/TIFF file OCR, and it takes precedence when both OCR features are requested. Source: OCR docs and features list, verified 2026-07-11.

Production heuristic: choose OCR by the visual shape of the image, not by the file extension alone. A product photo with a nutrition label may need TEXT_DETECTION for quick copy extraction, while a phone photo of a printed invoice should usually use DOCUMENT_TEXT_DETECTION because block/paragraph/word structure is valuable.

Documented fact: Cloud Vision's fullTextAnnotation organizes extracted UTF-8 text as Page -> Block -> Paragraph -> Word -> Symbol, with bounding boxes and per-component properties. The older textAnnotations output continues to be supported. Source: dense document text tutorial, verified 2026-07-11.

Production heuristic: evaluate OCR output at the unit your downstream workflow consumes. For search indexing, document-level text recall may be enough. For captions, forms, or layout-sensitive design review, measure word-level accuracy, bounding-box placement, reading order, line breaks, and confidence behavior separately.

Request modes, storage, and IAM

Documented fact: synchronous images:annotate returns inline annotations and accepts up to 16 images per request. Offline asynchronous images:asyncBatchAnnotate starts a long-running operation and writes JSON output to a Cloud Storage bucket; it accepts up to 2000 image files per request. Source: batch image annotation and quotas, verified 2026-07-11.

Documented fact: file annotation has separate limits. Synchronous files:annotate can annotate one file and up to 5 pages. Asynchronous files:asyncBatchAnnotate can annotate up to 2000 pages per PDF/TIFF file and writes JSON to Cloud Storage. Source: batch, PDF/TIFF OCR, and quotas, verified 2026-07-11.

Documented fact: for PDF/TIFF offline large batch annotation, Google currently supports only DOCUMENT_TEXT_DETECTION and TEXT_DETECTION; the file must be in Cloud Storage, output is written to Cloud Storage, and API keys are not supported for files:asyncBatchAnnotate. The authenticating account must have access to the input and write permission to the output bucket; Google names roles/editor or roles/storage.objectCreator or above for output creation in its PDF/TIFF docs. Source: PDF/TIFF OCR, verified 2026-07-11.

Documented fact: Cloud Vision can fetch remote HTTP/HTTPS image URLs, but Google warns that completion is not guaranteed because hosts can deny, throttle, or be throttled for abuse-prevention reasons; Google recommends not depending on externally hosted images for production. Source: multiple Cloud Vision feature docs, verified 2026-07-11.

Production heuristic: in production, copy user-supplied or third-party images into a controlled Cloud Storage bucket before annotation. This gives stable access, uniform IAM, retryability, lifecycle rules, audit logs, and cleaner deletion.

Production checklist for Cloud Storage pipelines:

Region and data handling

Documented fact: for OCR features (TEXT_DETECTION and DOCUMENT_TEXT_DETECTION), Cloud Vision supports the global endpoint plus region-based endpoints for United States and European Union processing/storage: us-vision.googleapis.com and eu-vision.googleapis.com. Google says this regional functionality currently only applies to OCR. Source: OCR docs and PDF/TIFF OCR, verified 2026-07-11.

Documented fact: Google says it does not use content sent to Vision API for purposes other than providing the service, does not make submitted content public, does not use submitted content to train/improve Cloud Vision features, and does not claim ownership of submitted content. For online operations, image data is processed in memory and not persisted to disk. For asynchronous offline batch operations, Google stores the image briefly to perform analysis and return results, typically deleting it after processing with a failsafe TTL of a few hours. Google also temporarily logs metadata such as request time and request size. Source: Cloud Vision Data Usage FAQ, verified 2026-07-11.

Production heuristic: privacy obligations do not end at the API boundary. Check whether the image contains faces, IDs, minors, medical content, location data, documents, or confidential products. Minimize retention in your own buckets, avoid public URLs, redact before annotation when the task permits, and keep the annotation JSON under the same access controls as the source image.

Quotas, limits, and cost model

Documented facts from Google Cloud Vision quotas and pricing, verified 2026-07-11:

Production heuristic: estimate cost as:

billable_units = number_of_images_or_pages * number_of_paid_features_per_image

Then adjust for bundle behavior such as SafeSearch with Label Detection and Crop Hints with Image Properties, free monthly tier, downstream Cloud Storage charges, retries, failed-item handling, and non-USD SKU pricing.

Confidence and QA practice

Documented fact: Cloud Vision returns feature-specific scores, likelihood enums, bounding polygons, normalized vertices, confidence values, topicality values, crop importance fractions, and web entity/match fields depending on feature. Source: Cloud Vision feature docs and response examples, verified 2026-07-11.

Production heuristics for evaluation:

Product search, custom models, and lifecycle boundaries

Documented fact: Vision API Product Search lets retailers create products with reference images, group products into product sets, and query with user images to return visually and semantically similar products. It supports product categories including homegoods, apparel, toys, packaged goods, and general. Source: Vision API Product Search docs, verified 2026-07-11.

Documented fact: the Product Search documentation currently displays a maintenance-mode notice: "The Product Search feature is in maintenance mode. For better scalability and the same functionality as Product Search, use the Vision Warehouse." Source: Vision API Product Search docs, verified 2026-07-11.

Production heuristic: do not design new catalog search systems around legacy Product Search without validating the lifecycle and Vision Warehouse migration path with current Google docs and account support. For simple one-off tagging or object detection, standard Cloud Vision may be enough. For custom business taxonomies, train/evaluate a custom model path. For ecommerce visual similarity at scale, evaluate Vision Warehouse/current Google retail search offerings rather than assuming Cloud Vision label/object APIs are catalog search.

Operational workflow

  1. Define the annotation contract: exact features, desired fields, thresholds, output schema, and human-review route.
  2. Validate input handling: accepted file type, size, resolution, orientation, EXIF, color profile assumptions, Cloud Storage URI, IAM, and retention policy.
  3. Run a small labeled pilot with representative images and at least one negative-control set.
  4. Tune thresholds and post-processing per feature. Keep raw confidence values for analysis, but output decisions as explicit labels such as pass, review, or block with reasons.
  5. Choose sync for small user-facing interactions; choose async batch for large backfills, PDF/TIFF OCR, and offline jobs.
  6. Estimate cost and quota. Include every feature per image/page, retries, Cloud Storage, and monthly free tier. Request quota changes before launch.
  7. Add QA dashboards: failure rates by feature, empty responses, low-confidence rates, OCR character error, moderation review overturn rate, and batch-operation queue lag.
  8. Revalidate after major source-distribution changes: new camera app, new region/language, new packaging, new document template, new moderation policy, or Google API behavior/pricing changes.

Example: multi-feature asset intake annotation

Example, not a mandatory formula.

Production intent: tag incoming still images for a media library, identify major objects, prefilter explicit content, extract sparse text, and store enough raw data for QA.

Provider and feature choice: Cloud Vision LABEL_DETECTION, OBJECT_LOCALIZATION, SAFE_SEARCH_DETECTION, and TEXT_DETECTION on controlled Cloud Storage inputs. This is better than Gemini because the pipeline needs structured fields and repeatable thresholds, not a prose description.

Inputs and constraints:

Complete REST request body:

{
  "requests": [
    {
      "image": {
        "source": {
          "imageUri": "gs://media-intake-prod/raw/2026/07/11/example.jpg"
        }
      },
      "features": [
        { "type": "LABEL_DETECTION", "maxResults": 20 },
        { "type": "OBJECT_LOCALIZATION", "maxResults": 20 },
        { "type": "SAFE_SEARCH_DETECTION" },
        { "type": "TEXT_DETECTION" }
      ]
    }
  ]
}

Interpretation plan:

Why structured this way: Cloud Vision bills each selected feature, so the request includes only features used by downstream decisions. The thresholds are production policy, not provider truth; they must be calibrated with a labeled sample.

Likely failure modes:

Meaningful variations:

Example: dense document OCR from PDF/TIFF

Example, not a mandatory formula.

Production intent: extract text from scanned PDF statements for internal search and document routing.

Provider and feature choice: Cloud Vision files:asyncBatchAnnotate with DOCUMENT_TEXT_DETECTION, because the input is a multi-page dense document in Cloud Storage. Consider Document AI instead if the goal is to parse fields, tables, entities, forms, or invoices into structured business records.

Inputs and constraints:

Complete REST request body:

{
  "requests": [
    {
      "inputConfig": {
        "gcsSource": {
          "uri": "gs://doc-intake-prod/incoming/acct-1931.pdf"
        },
        "mimeType": "application/pdf"
      },
      "features": [
        {
          "type": "DOCUMENT_TEXT_DETECTION"
        }
      ],
      "outputConfig": {
        "gcsDestination": {
          "uri": "gs://doc-intake-prod/vision-output/acct-1931/"
        },
        "batchSize": 10
      }
    }
  ]
}

HTTP endpoint:

POST https://vision.googleapis.com/v1/files:asyncBatchAnnotate

Expected result: the initial response returns a long-running operation name. When the operation state is DONE, JSON output files appear under the destination prefix. Each output resembles image OCR output and includes context about the source file and page range.

QA plan:

Likely failure modes:

Meaningful variations:

Example: social crop QA with crop hints and color properties

Example, not a mandatory formula.

Production intent: prepare editorial images for 1:1, 4:5, and 9:16 social placements while preserving subjects, text, product edges, and brand colors.

Provider and feature choice: Cloud Vision CROP_HINTS plus IMAGE_PROPERTIES. Crop hints give candidate polygons for requested aspect ratios; image properties provide dominant colors for layout theming or contrast checks.

Inputs and constraints:

Complete REST request body:

{
  "requests": [
    {
      "image": {
        "source": {
          "imageUri": "gs://campaign-prod/selects/hero-014.jpg"
        }
      },
      "features": [
        { "type": "CROP_HINTS" },
        { "type": "IMAGE_PROPERTIES", "maxResults": 10 }
      ],
      "imageContext": {
        "cropHintsParams": {
          "aspectRatios": [1.0, 0.8, 0.5625]
        }
      }
    }
  ]
}

Interpretation plan:

Why structured this way: crop hints automate first-pass saliency, but final crops are production design decisions. The response's confidence and importanceFraction help rank candidates, not approve them automatically.

Likely failure modes:

Meaningful variations:

Source notes

Primary first-party sources consulted and verified 2026-07-11:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.