Grocery Delivery Image API Benchmark (Claid.ai, Picsart)

On this page you will find a comparison of our Image Editing API against some of our competitors, on the specific use case of Grocery Delivery images.

Use Case description

Grocery delivery services need to display an image for each product on their catalog:

  • it makes it much easier for the user to navigate that catalog

  • it helps the user build trust that they are buying the correct product

Additionally, it's important that all these images follow the same brand guidelines, such as:

  • 16:9 aspect ratio

  • white background

  • centered product, with 10% padding

However, it's not trivial to come up with such images.

You might have to deal with vendor images that all have different backgrounds and aspect ratios:

Or you might also have to handle images that were taken directly inside the store:

Results

UGC Images

Vendor Images

Reproducing the results

If you want to reproduce the results of this benchmark, here are the Python scripts that were used to generate the images.

Before running this code, please download the original images that you want to re-process and place them in a directory called original-images.

import os
import requests
import concurrent.futures

API_KEY = "YOUR_PHOTOROOM_API_KEY"

def process_image(input_image_path, output_image_path):
    try:
        url = "https://image-api.photoroom.com/v2/edit"

        with open(input_image_path, 'rb') as image_file:
            files = { "imageFile": image_file }

            headers = {
                "x-api-key": API_KEY
            }

            payload = {
                "outputSize": "1920x1080",
                "export.format": "jpg",
                "background.color": "white",
                "padding": "0.1",
                "ignorePaddingAndSnapOnCroppedSides": "false",
                "lighting.mode": "ai.auto",
            }

            response = requests.post(url, data=payload, files=files, headers=headers)
            response.raise_for_status()

            with open(output_image_path, 'wb') as f:
                f.write(response.content)
                print(f"Image downloaded and saved to {output_image_path}")

    except requests.RequestException as e:
        print(f"Error: {str(e)} ({input_image_path})")
        return str(e)
    
def iterate_over_directory(directory_path, result_directory):
    with concurrent.futures.ThreadPoolExecutor(max_workers=16) as executor:
        for root, _, files in os.walk(directory_path):
            for file in files:
                if file.lower().endswith(('.png', '.jpg', '.jpeg', '.webp', '.heic')):
                    file_path = os.path.join(root, file)

                    result_file_name = os.path.splitext(os.path.basename(file_path))[0] + '-photoroom.jpg'
                    result_file_directory = os.path.join(result_directory, os.path.basename(root))

                    if not os.path.exists(result_file_directory):
                        os.makedirs(result_file_directory)

                    result_path = os.path.join(result_file_directory, result_file_name)

                    if not os.path.exists(result_path): # don't re-process images 
                        executor.submit(process_image, file_path, result_path)    

if __name__ == "__main__":
    INPUT_DIRECTORY = "./original-images/"
    OUTPUT_DIRECTORY = "./result-photoroom/"

    if not os.path.exists(OUTPUT_DIRECTORY):
        os.makedirs(OUTPUT_DIRECTORY)

    iterate_over_directory(directory_path=INPUT_DIRECTORY, result_directory=OUTPUT_DIRECTORY)

Last updated