|
| 1 | +// Copyright 2025 Google LLC |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | + |
| 15 | +syntax = "proto3"; |
| 16 | + |
| 17 | +package google.shopping.merchant.productstudio.v1alpha; |
| 18 | + |
| 19 | +import "google/api/annotations.proto"; |
| 20 | +import "google/api/client.proto"; |
| 21 | +import "google/api/field_behavior.proto"; |
| 22 | +import "google/api/resource.proto"; |
| 23 | +import "google/protobuf/timestamp.proto"; |
| 24 | +import "google/shopping/merchant/productstudio/v1alpha/productstudio_common.proto"; |
| 25 | + |
| 26 | +option go_package = "cloud.google.com/go/shopping/merchant/productstudio/apiv1alpha/productstudiopb;productstudiopb"; |
| 27 | +option java_multiple_files = true; |
| 28 | +option java_outer_classname = "ImageProto"; |
| 29 | +option java_package = "com.google.shopping.merchant.productstudio.v1alpha"; |
| 30 | + |
| 31 | +// Service that exposes Generative AI (GenAI) endpoints for creating and |
| 32 | +// enhancing product image content. |
| 33 | +service ImageService { |
| 34 | + option (google.api.default_host) = "merchantapi.googleapis.com"; |
| 35 | + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/content"; |
| 36 | + |
| 37 | + // GenerateProductImageBackground generates a new image where the background |
| 38 | + // of the original image is replaced by an AI generated scene based on |
| 39 | + // provided product information and a text prompt. |
| 40 | + rpc GenerateProductImageBackground(GenerateProductImageBackgroundRequest) |
| 41 | + returns (GenerateProductImageBackgroundResponse) { |
| 42 | + option (google.api.http) = { |
| 43 | + post: "/productstudio/v1alpha/{name=accounts/*}/generatedImages:generateProductImageBackground" |
| 44 | + body: "*" |
| 45 | + }; |
| 46 | + option (google.api.method_signature) = "name"; |
| 47 | + } |
| 48 | + |
| 49 | + // RemoveProductImageBackground generates a new image where the background of |
| 50 | + // the original image is removed. |
| 51 | + rpc RemoveProductImageBackground(RemoveProductImageBackgroundRequest) |
| 52 | + returns (RemoveProductImageBackgroundResponse) { |
| 53 | + option (google.api.http) = { |
| 54 | + post: "/productstudio/v1alpha/{name=accounts/*}/generatedImages:removeProductImageBackground" |
| 55 | + body: "*" |
| 56 | + }; |
| 57 | + option (google.api.method_signature) = "name"; |
| 58 | + } |
| 59 | + |
| 60 | + // UpscaleProductImage generates a new image where the resolution of the |
| 61 | + // original image is enhanced. |
| 62 | + rpc UpscaleProductImage(UpscaleProductImageRequest) |
| 63 | + returns (UpscaleProductImageResponse) { |
| 64 | + option (google.api.http) = { |
| 65 | + post: "/productstudio/v1alpha/{name=accounts/*}/generatedImages:upscaleProductImage" |
| 66 | + body: "*" |
| 67 | + }; |
| 68 | + option (google.api.method_signature) = "name"; |
| 69 | + } |
| 70 | +} |
| 71 | + |
| 72 | +// Request message for the GenerateProductImageBackground method. |
| 73 | +message GenerateProductImageBackgroundRequest { |
| 74 | + // Required. The account for which to generate an image. This acts as a |
| 75 | + // container for the request and does not affect the generation itself. |
| 76 | + // Format: accounts/{account} |
| 77 | + string name = 1 [(google.api.field_behavior) = REQUIRED]; |
| 78 | + |
| 79 | + // Optional. Configuration for how the output image should be returned. |
| 80 | + OutputImageConfig output_config = 2 [(google.api.field_behavior) = OPTIONAL]; |
| 81 | + |
| 82 | + // Required. The input image. |
| 83 | + InputImage input_image = 3 [(google.api.field_behavior) = REQUIRED]; |
| 84 | + |
| 85 | + // Required. Configuration parameters for the generation of the background. |
| 86 | + GenerateImageBackgroundConfig config = 4 |
| 87 | + [(google.api.field_behavior) = REQUIRED]; |
| 88 | +} |
| 89 | + |
| 90 | +// Response message for the GenerateProductImageBackground method. |
| 91 | +message GenerateProductImageBackgroundResponse { |
| 92 | + // The generated output image. |
| 93 | + GeneratedImage generated_image = 1; |
| 94 | +} |
| 95 | + |
| 96 | +// Request message for the RemoveProductImageBackground method. |
| 97 | +message RemoveProductImageBackgroundRequest { |
| 98 | + // Required. The account for which to generate an image. This acts as a |
| 99 | + // container for the request and does not affect the generation itself. |
| 100 | + // Format: accounts/{account} |
| 101 | + string name = 1 [(google.api.field_behavior) = REQUIRED]; |
| 102 | + |
| 103 | + // Optional. Configuration for how the output image should be returned. |
| 104 | + OutputImageConfig output_config = 2 [(google.api.field_behavior) = OPTIONAL]; |
| 105 | + |
| 106 | + // Required. The input image. |
| 107 | + InputImage input_image = 3 [(google.api.field_behavior) = REQUIRED]; |
| 108 | + |
| 109 | + // Optional. Configuration parameters for the removal of the background. |
| 110 | + RemoveImageBackgroundConfig config = 4 |
| 111 | + [(google.api.field_behavior) = OPTIONAL]; |
| 112 | +} |
| 113 | + |
| 114 | +// Response message for the RemoveProductImageBackground method. |
| 115 | +message RemoveProductImageBackgroundResponse { |
| 116 | + // The generated output image. |
| 117 | + GeneratedImage generated_image = 1; |
| 118 | +} |
| 119 | + |
| 120 | +// Request message for the UpscaleProductImage method. |
| 121 | +message UpscaleProductImageRequest { |
| 122 | + // Required. The account for which to generate an image. This acts as a |
| 123 | + // container for the request and does not affect the generation itself. |
| 124 | + // Format: accounts/{account} |
| 125 | + string name = 1 [(google.api.field_behavior) = REQUIRED]; |
| 126 | + |
| 127 | + // Optional. Configuration for how the output image should be returned. |
| 128 | + OutputImageConfig output_config = 2 [(google.api.field_behavior) = OPTIONAL]; |
| 129 | + |
| 130 | + // Required. The input image. |
| 131 | + InputImage input_image = 3 [(google.api.field_behavior) = REQUIRED]; |
| 132 | +} |
| 133 | + |
| 134 | +// Response message for the UpscaleProductImage method. |
| 135 | +message UpscaleProductImageResponse { |
| 136 | + // The generated output image. |
| 137 | + GeneratedImage generated_image = 1; |
| 138 | +} |
| 139 | + |
| 140 | +// Represents a generated image object. |
| 141 | +message GeneratedImage { |
| 142 | + option (google.api.resource) = { |
| 143 | + type: "merchantapi.googleapis.com/GeneratedImage" |
| 144 | + pattern: "accounts/{account}/generatedImages/{generated_image}" |
| 145 | + plural: "generatedImages" |
| 146 | + singular: "generatedImage" |
| 147 | + }; |
| 148 | + |
| 149 | + // The generated image. |
| 150 | + oneof image { |
| 151 | + // Generally web-requestable URI of the generated image. This is a temporary |
| 152 | + // URI and will expire after 6 months. A URI may not be populated |
| 153 | + // immediately after generation. Use get or list api using image_id to get |
| 154 | + // the URI. |
| 155 | + string uri = 2; |
| 156 | + |
| 157 | + // Raw bytes for the image. |
| 158 | + bytes image_bytes = 3; |
| 159 | + } |
| 160 | + |
| 161 | + // Identifier. The unique key for the image. |
| 162 | + string name = 1 [(google.api.field_behavior) = IDENTIFIER]; |
| 163 | + |
| 164 | + // The timestamp when the image was generated. |
| 165 | + google.protobuf.Timestamp generation_time = 4; |
| 166 | +} |
| 167 | + |
| 168 | +// Configuration for how the output image should be returned. |
| 169 | +message OutputImageConfig { |
| 170 | + // Optional. If true, returns the output images as serving uris instead of |
| 171 | + // bytes. |
| 172 | + bool return_image_uri = 1 [(google.api.field_behavior) = OPTIONAL]; |
| 173 | +} |
| 174 | + |
| 175 | +// Client provided input configuration for generating the background. |
| 176 | +message GenerateImageBackgroundConfig { |
| 177 | + // Required. Example: "Hat on a baseball field" |
| 178 | + // "Hat" = product description |
| 179 | + // Description of product. |
| 180 | + string product_description = 1 [(google.api.field_behavior) = REQUIRED]; |
| 181 | + |
| 182 | + // Required. Example: "Hat on a baseball field" |
| 183 | + // "on a baseball field" = background description |
| 184 | + // Description of wanted background. |
| 185 | + string background_description = 2 [(google.api.field_behavior) = REQUIRED]; |
| 186 | +} |
| 187 | + |
| 188 | +// Client provided input configuration for removing the background. |
| 189 | +message RemoveImageBackgroundConfig { |
| 190 | + // Optional. If set, the result of background removal will be an RGB image |
| 191 | + // with this given color as the background, instead of an RGBA 4-channel |
| 192 | + // transparent image. |
| 193 | + RgbColor background_color = 1 [(google.api.field_behavior) = OPTIONAL]; |
| 194 | +} |
| 195 | + |
| 196 | +// Represents a color in RGB format. |
| 197 | +message RgbColor { |
| 198 | + // Optional. Values in [0, 255]. |
| 199 | + int32 red = 1 [(google.api.field_behavior) = OPTIONAL]; |
| 200 | + |
| 201 | + // Optional. Values in [0, 255]. |
| 202 | + int32 green = 2 [(google.api.field_behavior) = OPTIONAL]; |
| 203 | + |
| 204 | + // Optional. Values in [0, 255]. |
| 205 | + int32 blue = 3 [(google.api.field_behavior) = OPTIONAL]; |
| 206 | +} |
0 commit comments