Method: projects.image.redact

Redacts potentially sensitive info from an image. This method has limits on input size, processing time, and output size. See https://cloud.google.com/dlp/docs/redacting-sensitive-data-images to learn more.

When no InfoTypes or CustomInfoTypes are specified in this request, the system will automatically choose what detectors to run. By default this may be all types, but may change over time as detectors are updated.

HTTP request

POST https://dlp.googleapis.com/v2/{parent=projects/*}/image:redact

The URL uses gRPC Transcoding syntax.

Path parameters

Parameters
parent

string

The parent resource name, for example projects/my-project-id.

Authorization requires the following Google IAM permission on the specified resource parent:

  • serviceusage.services.use

Request body

The request body contains data with the following structure:

JSON representation
{
  "inspectConfig": {
    object(InspectConfig)
  },
  "imageRedactionConfigs": [
    {
      object(ImageRedactionConfig)
    }
  ],
  "includeFindings": boolean,
  "byteItem": {
    object(ByteContentItem)
  }
}
Fields
inspectConfig

object(InspectConfig)

Configuration for the inspector.

imageRedactionConfigs[]

object(ImageRedactionConfig)

The configuration for specifying what content to redact from images.

includeFindings

boolean

Whether the response should include findings along with the redacted image.

byteItem

object(ByteContentItem)

The content must be PNG, JPEG, SVG or BMP.

Response body

If successful, the response body contains data with the following structure:

Results of redacting an image.

JSON representation
{
  "redactedImage": string,
  "extractedText": string,
  "inspectResult": {
    object(InspectResult)
  }
}
Fields
redactedImage

string (bytes format)

The redacted image. The type will be the same as the original image.

A base64-encoded string.

extractedText

string

If an image was being inspected and the InspectConfig's includeQuote was set to true, then this field will include all text, if any, that was found in the image.

inspectResult

object(InspectResult)

The findings. Populated when includeFindings in the request is true.

Authorization Scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

ImageRedactionConfig

Configuration for determining how redaction of images should occur.

JSON representation
{
  "redactionColor": {
    object(Color)
  },

  // Union field target can be only one of the following:
  "infoType": {
    object(InfoType)
  },
  "redactAllText": boolean
  // End of list of possible types for union field target.
}
Fields
redactionColor

object(Color)

The color to use when redacting content from an image. If not specified, the default is black.

Union field target. Type of information to redact from images. target can be only one of the following:
infoType

object(InfoType)

Only one per infoType should be provided per request. If not specified, and redactAllText is false, the DLP API will redact all text that it matches against all infoTypes that are found, but not specified in another ImageRedactionConfig.

redactAllText

boolean

If true, all text found in the image, regardless whether it matches an infoType, is redacted. Only one should be provided.

Color

Represents a color in the RGB color space.

JSON representation
{
  "red": number,
  "green": number,
  "blue": number
}
Fields
red

number

The amount of red in the color as a value in the interval [0, 1].

green

number

The amount of green in the color as a value in the interval [0, 1].

blue

number

The amount of blue in the color as a value in the interval [0, 1].

Try it!

หน้านี้มีประโยชน์ไหม โปรดแสดงความคิดเห็น