# How to create e-commerce images with consistent brand guidelines

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 so that their look-and-feel is consistent across your entire catalog.

## Introduction

If you’re running an e-commerce website, you know how important it is to have product images that follow the same brand guidelines, so that the look-and-feel is consistent from one image to the next.

But if you're getting your product images from different sources, it's very likely that you receive them in very different aspect ratios, product positioning or even background color:

<div><figure><img src="https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2FeN2mc0vlWTURfpKWNWDc%2F1_7G_6RKDSqZ6E1BvULOxMleRakOiGsQ9.jpg?alt=media&#x26;token=c7dd93f7-a13d-4b06-861c-61ee889c8ea5" alt=""><figcaption></figcaption></figure> <figure><img src="https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2FdFx0Xbak1pqmrH6wMi4d%2F1-uJ6DnpzNC6A_10wGV2lZRIBF4879yHs.jpg?alt=media&#x26;token=3336d2a7-e473-4afc-bd99-9f48fca36fdf" alt=""><figcaption></figcaption></figure> <figure><img src="https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2FBDCerhJsJYsKafN9NbTo%2F1a_6N688DYGi9ia3YimyCmUnOkExV84XF.jpg?alt=media&#x26;token=391aef67-4f99-4bdc-b5e7-caecc7afb496" alt=""><figcaption></figcaption></figure> <figure><img src="https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2Fn9z58Vv82UQziYFPlz5S%2F1uqPLMWWYYBnMNuW3wrF5nR7XsWIAicaN.jpg?alt=media&#x26;token=d36873f9-7eb1-4cf9-9f17-1143c9e2e3b6" alt=""><figcaption></figcaption></figure> <figure><img src="https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2F4tX20Yg4udv3i8xQbuGP%2F1UyUSkCzFfE8GDp6NajYl8OH6dC3bYdTa.jpg?alt=media&#x26;token=0097e5a4-e697-46f4-95ce-9d440a622afe" alt=""><figcaption></figcaption></figure></div>

However what you want is to have all your images follow the same brand guidelines, such as:

* 1920x1080 pixels
* white background
* centered product
* 10% of padding

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

## Implementation

### Output Size

Let's start by making sure that the result images all have the same resolution.

We can configure the resolution through the parameter `outputSize`, by setting its value to `1920x1080`.

### 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`.

### Centered Product

By default, the [Image Editing API](https://docs.photoroom.com/image-editing-api-plus-plan) will automatically center the product in the result image.

However, if some sides of the product are cropped, then by default the API will snap these sides of the product to the corresponding edges of the result image.

The goal of this behavior is to avoid having empty whitespace between the cropped edges of the product and the edges of the result image:

But if needed, this behavior can be disabled by setting the parameter `ignorePaddingAndSnapOnCroppedSides` to `false`.

{% hint style="info" %}
If needed, it's also possible to [manually control the horizontal and/or vertical alignment of the product](https://docs.photoroom.com/image-editing-api-plus-plan/positioning#horizontal-and-vertical-alignments).

This can be very useful to display products that have different aspect ratios is a harmonious way, like in this example:

![](https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2Fu7VtYKmQaq2KmZq1Nvaj%2Fimage.jpeg?alt=media\&token=94304d4a-c614-481d-8e4a-642613b3295b)
{% endhint %}

### Padding

Finally, we need to configure the [positionning of the product](https://docs.photoroom.com/image-editing-api-plus-plan/positioning), so that there's 10% of padding between the product and the edges of the result image.

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

## API Call

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

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=1920x1080 \
  --form background.color=white \
  --form padding='10%' \
  --form ignorePaddingAndSnapOnCroppedSides=false \
  --output result.png
```

<a href="https://try-api.photoroom.com/?outputSize=1920x1080&#x26;background.color=white&#x26;padding=10%25&#x26;ignorePaddingAndSnapOnCroppedSides=false" 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%2FeN2mc0vlWTURfpKWNWDc%2F1_7G_6RKDSqZ6E1BvULOxMleRakOiGsQ9.jpg?alt=media\&token=c7dd93f7-a13d-4b06-861c-61ee889c8ea5) | ![](https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2FUq6A0vxiGKtFd7sUg9Rh%2F1_7G_6RKDSqZ6E1BvULOxMleRakOiGsQ9.png?alt=media\&token=5f017432-aef4-4daa-bc83-95576e801b62) |
| ![](https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2F4tX20Yg4udv3i8xQbuGP%2F1UyUSkCzFfE8GDp6NajYl8OH6dC3bYdTa.jpg?alt=media\&token=0097e5a4-e697-46f4-95ce-9d440a622afe) | ![](https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2FZqNegQHfCdPuFFEHQEtl%2F1UyUSkCzFfE8GDp6NajYl8OH6dC3bYdTa.png?alt=media\&token=376c2c3b-25cb-41f4-af60-e885c31e0629) |
| ![](https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2Fn9z58Vv82UQziYFPlz5S%2F1uqPLMWWYYBnMNuW3wrF5nR7XsWIAicaN.jpg?alt=media\&token=d36873f9-7eb1-4cf9-9f17-1143c9e2e3b6) | ![](https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2FDAigd2FuEHulFTLdTGJG%2F1uqPLMWWYYBnMNuW3wrF5nR7XsWIAicaN.png?alt=media\&token=17a1b2fe-833c-402d-9db6-21cd56d665da) |
| ![](https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2FBDCerhJsJYsKafN9NbTo%2F1a_6N688DYGi9ia3YimyCmUnOkExV84XF.jpg?alt=media\&token=391aef67-4f99-4bdc-b5e7-caecc7afb496) | ![](https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2Fv5327xNlXD4v6ql6lDz8%2F1a_6N688DYGi9ia3YimyCmUnOkExV84XF.png?alt=media\&token=5dc715f6-0f10-4da5-80fe-59f29358be09) |
| ![](https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2FdFx0Xbak1pqmrH6wMi4d%2F1-uJ6DnpzNC6A_10wGV2lZRIBF4879yHs.jpg?alt=media\&token=3336d2a7-e473-4afc-bd99-9f48fca36fdf) | ![](https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2F2616JVbcS3Q2ujLI3KaX%2F1-uJ6DnpzNC6A_10wGV2lZRIBF4879yHs.png?alt=media\&token=6f4e3e6d-efcd-4c99-9435-44668686f6d9) |

## Conclusion

The [Image Editing API](https://docs.photoroom.com/image-editing-api-plus-plan) allows you to easily edit your product images so that they comply with your brand guidelines and that you have a consistent look-and-feel across your entire catalog.

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>
