Developer Offer
Try ImaginePro API with 50 Free Credits
Build and ship AI-powered visuals with Midjourney, Flux, and more — free credits refresh every month.
Boost Image Resolution with Imagen on Vertex AI
Unlock the power of high-resolution imagery by using Imagen on Vertex AI to increase the size of your images without sacrificing quality. This guide will walk you through the process, whether you prefer using the graphical interface or a programmatic approach via the REST API.
Model Version Compatibility
It's important to note that the upscaling feature is specific to certain model versions. Currently, it is only available for the original Imagen model.
Feature | Imagen (v.002) | Imagen 2 (v.005) | Imagen 2 (v.006) |
---|---|---|---|
Upscaling | ✔ | Not supported | Not supported |
Below are the code samples and steps to upscale an existing, generated, or edited image.
Upscaling via the Console
For a straightforward, user-friendly approach, you can use the Vertex AI console:
- First, follow the instructions to generate an image with text.
- Select the image you wish to enhance.
- Click Upscale/export.
- From the options, select Upscale images.
- Choose your desired Scale factor (
2x
or4x
). - Click Export to save your new, high-resolution image.
Upscaling via the REST API
For developers looking to integrate this feature into their applications, the REST API provides a powerful method. For detailed information on imagegeneration
model requests, refer to the model API reference.
To activate upscaling, you must include the "mode": "upscale"
parameter and the upscaleConfig
object in your JSON request.
Before you begin, replace the following placeholders in the request:
LOCATION
: The region for your project, such asus-central1
. See the list of available regions.PROJECT_ID
: Your unique Google Cloud project ID.B64_BASE_IMAGE
: The image you want to upscale, provided as a base64-encoded byte string (10 MB limit).IMAGE_SOURCE
: Alternatively, the Cloud Storage URI of your source image, e.g.,gs://output-bucket/source-photos/photo.png
.UPSCALE_FACTOR
: Optional. The factor to scale the image by. Available values arex2
orx4
.
API Endpoint
Use the following POST request URL:
Request Body
Construct your request with the following JSON structure:
{ "instances": [ { "prompt": "", "image": { // Use one of the following to specify the image "bytesBase64Encoded": "B64_BASE_IMAGE", "gcsUri": "IMAGE_SOURCE" } } ], "parameters": { "sampleCount": 1, "mode": "upscale", "upscaleConfig": { "upscaleFactor": "UPSCALE_FACTOR" } } }
Sending the Request
To execute your request, you can use one of the following command-line tools.
Using cURL
Save the request body to a file named request.json
and run the following command:
bash
curl -X POST
-H "Authorization: Bearer $(gcloud auth print-access-token)"
-H "Content-Type: application/json; charset=utf-8"
-d @request.json
"https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/publishers/google/models/imagegeneration@002:predict"
Using PowerShell
Save the request body to a file named request.json
and execute this command:
powershell $cred = gcloud auth print-access-token $headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest -Method POST
-Headers $headers -ContentType: "application/json; charset=utf-8"
-InFile request.json `
-Uri "https://LOCATION-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/publishers/google/models/imagegeneration@002:predict" | Select-Object -Expand Content
Sample API Response
A successful request will return a JSON response containing the upscaled image encoded in base64:
{ "predictions": [ { "mimeType": "image/png", "bytesBase64Encoded": "iVBOR..[base64-encoded-upscaled-image]...YII=" } ] }
What's Next?
To learn more about the latest advancements in Google's generative AI, explore these resources:
Compare Plans & Pricing
Find the plan that matches your workload and unlock full access to ImaginePro.
Plan | Price | Highlights |
---|---|---|
Standard | $8 / month |
|
Premium | $20 / month |
|
Need custom terms? Talk to us to tailor credits, rate limits, or deployment options.
View All Pricing Details