Images

Select and Crop Image

Cropping is only relevant for editing existing products. You cannot crop an image the first time you upload it to the system.

POST
/cgi/product_image_crop.pl
codestring

Barcode of the product.

imgidinteger

identifier of the image to select, it should be a number

idstring

identifier of the selected image field, should be in the format {IMAGE_TYPE}_{LANG} format, where IMAGE_TYPE is one of front|ingredients|nutrition|packaging|other and LANG is the 2 letter language code. Note that if you select an image for the main language of the product (ex: ingredients_it if it is the main language), this image will be displayed on Product Opener for all languages (ex: on https://fr.openfoodfacts.org, unless ingredients_fr exists).

x1?integer

X origin coordinate of the crop, it must be lower than x2

y1?integer

Y origin coordinate of the crop, it must be lower than y2

x2?integer

X end coordinate of the crop, it must be higher than x1

y2?integer

Y end coordinate of the crop, it must be higher than y1

angle?integer

angle of the rotation to apply on the selected image. passing 90 as value rotate the image 90 degrees counter-clockwise.

normalize?string

whether the selected image should be normalized using ImageMagick

Value in"true" | "false"
white_magic?string

whether the source image should be white magiced (background removal) using ImageMagick.

Default"false"
Value in"true" | "false"
comment?string

A comment on the contribution. Adding meaningful comments help moderators and users understand a single product history.

app_name?string

Name of the app providing the information

app_version?string

Version of the app providing the information

app_uuid?string

When an app uses a single user to log its contributions, it might be interesting to know which user of the app is providing the information. You can use this field to provide an identifier (eg: an sha1 of the username) that's privacy preserving. Make sure that your salt is strong, perfectly random and secret

In case we have trouble with one of your user, it helps our moderators revert edits.

User-Agent?string

It is required that you pass a specific User-Agent header when you do an API request. But some times it's not possible to modify such a header (eg. request using JavaScript in a browser). In such cases, you can override it with this parameter.

Response Body

curl -X POST "https://world.openfoodfacts.net/cgi/product_image_crop.pl" \
  -F code="04963406" \
  -F imgid="2" \
  -F id="front_en"
{}