This document describes how to use the Cloud Data Loss Prevention API to detect sensitive text and objects in an image. Sensitive Data Protection returns the location of any sensitive data that it detects.
Given an image as input, Sensitive Data Protection detects sensitive data
in the image. The output of an inspection operation includes the detected
infoTypes, the
likelihood of the match, and pixel
coordinates and length values that indicate the areas within which
Sensitive Data Protection found the sensitive data. The coordinates at the bottom
left corner of an image are (0,0).
Inspect an image for all default infoTypes
To inspect an image for sensitive data, you submit a base64-encoded image to the
content.inspect
method. If you don't specify specific information types (infoTypes)
to search for, Sensitive Data Protection
searches for the most common infoTypes.
To inspect an image for all default infoTypes, follow these steps:
- Encode the image as base64.
- Submit a request to the
content.inspectmethod of the DLP API. The request requires only the base64-encoded image.
For example, consider this image of a document.
C#
To learn how to install and use the client library for Sensitive Data Protection, see Sensitive Data Protection client libraries.
To authenticate to Sensitive Data Protection, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.