Image processing

Crop an image

This endpoint is currently only used to generate cropped logos on Hunger Games from a base image and cropping coordinates. Cropping coordinates are relative (between 0. and 1. inclusive), with (0, 0) being the upper left corner.

GET
/images/crop

Query Parameters

image_url?string

The URL of the input image

Formaturi
y_min?number

The minimum y-coordinate for cropping, relative to the image height. We use relative coordinates, with (0, 0) being the upper left corner and (1, 1) being the lower right corner.

Range0 <= value <= 1
x_min?number

The minimum x-coordinate for cropping, relative to the image width. We use relative coordinates, with (0, 0) being the upper left corner and (1, 1) being the lower right corner.

Range0 <= value <= 1
y_max?number

The maximum y-coordinate for cropping, relative to the image height. We use relative coordinates, with (0, 0) being the upper left corner and (1, 1) being the lower right corner.

Range0 <= value <= 1
x_max?number

The maximum x-coordinate for cropping, relative to the image width. We use relative coordinates, with (0, 0) being the upper left corner and (1, 1) being the lower right corner.

Range0 <= value <= 1

Response Body

curl -X GET "https://robotoff.openfoodfacts.org/api/v1/images/crop?image_url=https%3A%2F%2Fimages.openfoodfacts.org%2Fimages%2Fproducts%2F541%2F004%2F104%2F0807%2F3.jpg&y_min=1&x_min=1&y_max=1&x_max=1"
"string"