# How to create compliant product images for Google Shopping

In this tutorial you will find the details of how the [Image Editing API](https://docs.photoroom.com/image-editing-api-plus-plan) enables you to edit your product images to make them compliant with the guidelines of Google Shopping.

## Introduction

If you’re running an e-commerce website or managing digital advertising campaigns for customers, you already know how important it is to have great-looking images of your products.

But if you want to list your products on Google Shopping, you must deal with an additional constraint: you’ll have to comply with the platform’s guidelines.

More specifically, [Google Shopping expects your product images to](https://www.youtube.com/watch?v=sbJKkbmPZf4):

1. show the product over a white background
2. have a square aspect-ratio, with at least 800 pixels per side
3. have the product occupy between 75% and 90% of the image

<figure><img src="https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2FFSWE5CjZT9Y66zewBZpM%2Fgoogle-shopping-guidelines.webp?alt=media&#x26;token=f3c040e5-e9f0-4c2d-83e0-d30f5cd198f1" alt=""><figcaption></figcaption></figure>

So let's go over how these guidelines can be implemented using the [Image Editing API](https://docs.photoroom.com/image-editing-api-plus-plan).

## Implementation

### Square Aspect-Ratio

Let's start by making sure the result image has a square aspect ratio.

We can configure the resolution of the result image through the parameter `outputSize`.

Here we need a square aspect-ratio, so we can set its value to, for example, `2000x2000`.

### White Background

By default, the [Image Editing API](https://docs.photoroom.com/image-editing-api-plus-plan) will remove the background of the input image, so there's no need to set a specific argument for it to happen.

However, we do need to specify that we want to result image to be on a white background.

To achieve this, we'll use the parameter `background.color` which allows us to [replace the background with a solid color](https://docs.photoroom.com/image-editing-api-plus-plan/static-background#solid-color) and set its value to `white`.

### Padding

Finally, we need to configure the [positionning of the product](https://docs.photoroom.com/image-editing-api-plus-plan/positioning), so that it occupies between 75% and 90% of the result image.

For this, we'll set the parameter `padding` to a value between `10%` and `25%`.

{% hint style="info" %}
By default, `padding` will be [ignored when a side of a product is cropped](https://docs.photoroom.com/image-editing-api-plus-plan/positioning#cropped-subject).&#x20;

If needed, this behavior can be disabled by setting the parameter `ignorePaddingAndSnapOnCroppedSides` to `false`.
{% endhint %}

## API Call

Using the parameters `outputSize`, `background.color` and `padding` we're now ready to automatically edit product images to make them compliant with the guidelines of Google Shopping.

Here's the API call we'll use:

```bash
curl --request POST \
  --url https://image-api.photoroom.com/v2/edit \
  --header 'x-api-key: YOUR_API_KEY_HERE' \
  --form imageFile=@/path/to/image.png \
  --form outputSize=2000x2000 \
  --form background.color=white \
  --form padding='10%' \
  --output result.png
```

<a href="https://try-api.photoroom.com/?outputSize=2000x2000&#x26;background.color=white&#x26;padding=10%25" class="button primary">Try it now!</a>

{% hint style="info" %}
If you don't have an API key, here are the [steps to create yours](https://docs.photoroom.com/getting-started/introduction#how-can-i-get-my-api-key).
{% endhint %}

## Results

Here's a before/after of the results this API call produces:

|                                                                                                                 *(original image)*                                                                                                                 |                                                                                                                  *(edited image)*                                                                                                                  |
| :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
|            ![](https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2FPwfI67B5eF4UnEAhWHzX%2Fm66901106936_1.jpg?alt=media\&token=c577b36a-5d59-47d8-b6e0-77a53a342742)            |            ![](https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2FIUMItIctCMLtgnEmyYC7%2Fm66901106936_1.png?alt=media\&token=3c0266dd-2786-4d58-946d-3dbaa23d7f24)            |
|            ![](https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2FmyRGz9voB8WAXOK08LaQ%2Fm58155757072_1.jpg?alt=media\&token=cc482694-bacc-4d75-81e2-ec25c0af4835)            |            ![](https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2FbWMctbSB8otWhJo8v6Wj%2Fm58155757072_1.png?alt=media\&token=67ed0d47-45fb-4659-af03-fce1e83b4371)            |
|            ![](https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2F6bfRiLQcZth8Qc2UqFj7%2Fm84390327592_1.jpg?alt=media\&token=e6861500-bbcd-4c1e-84f3-c43e469867b1)            |            ![](https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2FbhsJ3xMd7EEIHEV3NPR6%2Fm84390327592_1.png?alt=media\&token=8ebec8df-0e26-4342-ad9c-22eca1f56c46)            |
| ![](https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2F27c2JrxXg2tg49IbCGPM%2Fgiorgio-trovato-K62u25Jk6vo-unsplash.jpg?alt=media\&token=d4d82ede-6464-42cb-bd5f-4277f61f8612) | ![](https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2F8tpVzfaXZbfS9Li6phuG%2Fgiorgio-trovato-K62u25Jk6vo-unsplash.png?alt=media\&token=00f71870-f31c-4acb-8948-2b7a30118d41) |
|    ![](https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2FDP9Cx3NW61p1ogmx3f7s%2Fjoan-tran-reEySFadyJQ-unsplash.jpg?alt=media\&token=ad035226-8719-47a0-8834-67ec40f6ac79)    |    ![](https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2F33M1J57xH37GkSYMSVQo%2Fjoan-tran-reEySFadyJQ-unsplash.png?alt=media\&token=4993efbf-dea0-4a7d-94dc-47b6cc3c0d5c)    |
|    ![](https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2F1vSudzosp3jEDgNdHFz6%2Fvarun-gaba-dcgB3CgidlU-unsplash.jpg?alt=media\&token=87abfb9b-82f0-4f99-808d-b2f47a823683)   |    ![](https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2F2EDPbaaoXsrKeXVB65KX%2Fvarun-gaba-dcgB3CgidlU-unsplash.png?alt=media\&token=5d408e70-994b-4d11-aaff-fa3dea683569)   |

## Conclusion

The [Image Editing API](https://docs.photoroom.com/image-editing-api-plus-plan) allows you to easily create product images that are compliant with the guidelines of Google Shopping.

This tutorial took the example of Google Shopping, but you can of course also use the [Image Editing API](https://docs.photoroom.com/image-editing-api-plus-plan) to create compliant images for other advertising networks, such as [Amazon Advertising](https://advertising.amazon.com/) or [Meta (Facebook/Instagram) Shopping](https://business.meta.com/).

If you want to learn more, here's the details of the API features used in this tutorial:

* [Output Size](https://docs.photoroom.com/image-editing-api-plus-plan/output-size)
* [Solid Color Background](https://docs.photoroom.com/image-editing-api-plus-plan/static-background#solid-color)
* [Positioning](https://docs.photoroom.com/image-editing-api-plus-plan/positioning)

## Book a demo

If you'd like more information about how the Photoroom API can help you improve the quality of your images, don't hesitate to [contact our team to book a demo](https://www.photoroom.com/contact-sales?utm_source=apidocumentation\&utm_medium=enterprisegated).

<a href="https://www.photoroom.com/contact-sales?utm_source=apidocumentation&#x26;utm_medium=enterprisegated" class="button primary">Book a demo</a>
