Skip to content

Image Processing

Resize, compress, convert, watermark and read image metadata.

1. Overview

Base path: https://api.infrai.cc/v1/image
Auth header: Authorization: Bearer $INFRAI_API_KEY
bash
# Call any /v1/image capability over raw HTTP — no SDK to install.
# curl:
curl https://api.infrai.cc/v1/image/... \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json"

2. Methods (18)

2.1image.process

POST /v1/image/process

Process an image: resize, compress, convert, watermark, rotate or remove background.

Parameters

NameTypeRequiredDescription
inputImageRef { url? | base64? }
Required
Image reference as URL or base64.
widthnumberOptionalTarget width in pixels.
heightnumberOptionalTarget height in pixels.
format"auto" | "webp" | "avif" | "jpeg" | "png" | "heic"OptionalOutput image format.
qualitynumberOptionalCompression quality from 0 to 100.
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

ImageOpResult { image_url, mime, width?, height?, bytes }
NameTypeDescription
image_idstringUnique identifier for this image
pattern: ^pim_[A-Za-z0-9]{20,}$
urlstringURL for this resource or endpoint
format"auto" | "webp" | "avif" | "jpeg" | "png" | "heic"Output or input format (e.g. json, csv, png)
widthintegerWidth of the image in pixels
≥ 1
heightintegerHeight of the image in pixels
≥ 1
size_bytesintegerSize of the resource in bytes
≥ 0
sha256stringSHA-256 hash of the resource content
pattern: ^[a-f0-9]{64}$
original_sha256string | nullSHA-256 hash of the original image before processing
ops_appliedstring[]List of image operations that were applied
cost_usdnumber | nullCost of this operation in USD
≥ 0
created_atstringISO 8601 timestamp when this resource was created
format: date-time

Example

One-time prep (each example is assumed to be complete):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."
bash
curl -X POST https://api.infrai.cc/v1/image/process \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"image": {"url": "https://example.com/photo.jpg"}, "ops": [{"op": "resize", "params": {"width": 800}}, {"op": "compress", "params": {"quality": 80}}]}'

2.2image.metadata

POST /v1/image/metadata

Read image dimensions, MIME type and EXIF metadata.

Parameters

NameTypeRequiredDescription
inputImageRef { url? | base64? }
Required
Image reference as URL or base64.

Returns

{ width, height, mime, exif? }
NameTypeDescription
widthintegerWidth of the image in pixels
≥ 1
heightintegerHeight of the image in pixels
≥ 1
format"auto" | "webp" | "avif" | "jpeg" | "png" | "heic"Output or input format (e.g. json, csv, png)
size_bytesintegerSize of the resource in bytes
≥ 0
exifobject | nullRaw EXIF tag map; null when not read / not present.
color_spacestring | nulle.g. 'sRGB', 'CMYK'.
has_alphaboolean | nullWhether the image has an alpha channel
orientationinteger | nullEXIF orientation tag (1-8); null when unknown.
1–8

Example

One-time prep (each example is assumed to be complete):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."
bash
curl -X POST https://api.infrai.cc/v1/image/metadata \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"image": "sample"}'

2.3image.upload

POST /v1/image/upload

Upload image resources and return asset id and URL

Parameters

NameTypeRequiredDescription
filestring
Required
Image to upload: local file path or byte data
filenamestringOptionalOptional file name for storage and display
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

ImageAsset { id, url, mime, width?, height?, bytes }
NameTypeDescription
image_idstringUnique identifier for this image
pattern: ^pim_[A-Za-z0-9]{20,}$
urlstringURL for this resource or endpoint
format"auto" | "webp" | "avif" | "jpeg" | "png" | "heic"Output or input format (e.g. json, csv, png)
widthintegerWidth of the image in pixels
≥ 1
heightintegerHeight of the image in pixels
≥ 1
size_bytesintegerSize of the resource in bytes
≥ 0
sha256stringSHA-256 hash of the resource content
pattern: ^[a-f0-9]{64}$
original_sha256string | nullSHA-256 hash of the original image before processing
ops_appliedstring[]List of image operations that were applied
cost_usdnumber | nullCost of this operation in USD
≥ 0
created_atstringISO 8601 timestamp when this resource was created
format: date-time

Example

One-time prep (each example is assumed to be complete):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."
bash
curl -X POST https://api.infrai.cc/v1/image/upload \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"file": "sample"}'

2.4image.get

GET /v1/image/get/{id}

Read the meta information of a single image asset by id

Parameters

NameTypeRequiredDescription
idstring
Required
Image asset id

Returns

ImageAsset { id, url, mime, width?, height?, bytes }
NameTypeDescription
image_idstringUnique identifier for this image
pattern: ^pim_[A-Za-z0-9]{20,}$
urlstringURL for this resource or endpoint
format"auto" | "webp" | "avif" | "jpeg" | "png" | "heic"Output or input format (e.g. json, csv, png)
widthintegerWidth of the image in pixels
≥ 1
heightintegerHeight of the image in pixels
≥ 1
size_bytesintegerSize of the resource in bytes
≥ 0
sha256stringSHA-256 hash of the resource content
pattern: ^[a-f0-9]{64}$
original_sha256string | nullSHA-256 hash of the original image before processing
ops_appliedstring[]List of image operations that were applied
cost_usdnumber | nullCost of this operation in USD
≥ 0
created_atstringISO 8601 timestamp when this resource was created
format: date-time

Example

One-time prep (each example is assumed to be complete):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."
bash
curl -X GET https://api.infrai.cc/v1/image/get/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY"

2.5image.delete

DELETE /v1/image/delete/{id}

Delete stored image assets by id

Parameters

NameTypeRequiredDescription
idstring
Required
Image asset id to delete
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

{ ok: boolean }
NameTypeDescription
deletedbooleanWhether the resource was successfully deleted
image_idstring | nullUnique identifier for this image
pattern: ^pim_[A-Za-z0-9]{20,}$

Example

One-time prep (each example is assumed to be complete):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."
bash
curl -X DELETE https://api.infrai.cc/v1/image/delete/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY"

2.6image.resize

POST /v1/image/resize

Scale image to specified width and height

Parameters

NameTypeRequiredDescription
imageImageRef { url? | base64? | id? }
Required
Image reference as URL or base64.
widthnumberOptionalTarget width in pixels.
≥ 1
heightnumberOptionalTarget height in pixels.
≥ 1
fit"cover" | "contain" | "fill" | "inside" | "outside"OptionalScaling adaptation mode: inside/cover/contain/fill
enlargebooleanOptionalWhether to allow enlargement when the original image is smaller than the target size
default: false
format"auto" | "webp" | "avif" | "jpeg" | "png" | "heic"OptionalOutput image format.
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

ProcessedImage { image_url, mime, width, height, bytes }
NameTypeDescription
image_idstringUnique identifier for this image
pattern: ^pim_[A-Za-z0-9]{20,}$
urlstringURL for this resource or endpoint
format"auto" | "webp" | "avif" | "jpeg" | "png" | "heic"Output or input format (e.g. json, csv, png)
widthintegerWidth of the image in pixels
≥ 1
heightintegerHeight of the image in pixels
≥ 1
size_bytesintegerSize of the resource in bytes
≥ 0
sha256stringSHA-256 hash of the resource content
pattern: ^[a-f0-9]{64}$
original_sha256string | nullSHA-256 hash of the original image before processing
ops_appliedstring[]List of image operations that were applied
cost_usdnumber | nullCost of this operation in USD
≥ 0
created_atstringISO 8601 timestamp when this resource was created
format: date-time

Example

One-time prep (each example is assumed to be complete):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."
bash
curl -X POST https://api.infrai.cc/v1/image/resize \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"image": {"base64": "<...>"}, "width": 800, "fit": "cover"}'

2.7image.crop

POST /v1/image/crop

Crop image according to xywh rectangle

Parameters

NameTypeRequiredDescription
imageImageRef { url? | base64? | id? }
Required
Image reference as URL or base64.
xnumber
Required
The abscissa of the cropping starting point (pixels)
≥ 0
ynumber
Required
The vertical coordinate of the cropping starting point (pixels)
≥ 0
widthnumber
Required
Target width in pixels.
≥ 1
heightnumber
Required
Target height in pixels.
≥ 1
format"auto" | "webp" | "avif" | "jpeg" | "png" | "heic"OptionalOutput image format.
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

ProcessedImage { image_url, mime, width, height, bytes }
NameTypeDescription
image_idstringUnique identifier for this image
pattern: ^pim_[A-Za-z0-9]{20,}$
urlstringURL for this resource or endpoint
format"auto" | "webp" | "avif" | "jpeg" | "png" | "heic"Output or input format (e.g. json, csv, png)
widthintegerWidth of the image in pixels
≥ 1
heightintegerHeight of the image in pixels
≥ 1
size_bytesintegerSize of the resource in bytes
≥ 0
sha256stringSHA-256 hash of the resource content
pattern: ^[a-f0-9]{64}$
original_sha256string | nullSHA-256 hash of the original image before processing
ops_appliedstring[]List of image operations that were applied
cost_usdnumber | nullCost of this operation in USD
≥ 0
created_atstringISO 8601 timestamp when this resource was created
format: date-time

Example

One-time prep (each example is assumed to be complete):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."
bash
curl -X POST https://api.infrai.cc/v1/image/crop \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"image": "sample", "x": 1, "y": 1, "width": 1, "height": 1}'

2.8image.smart_crop

POST /v1/image/smart_crop

Saliency-aware cropping to specified aspect ratio

Parameters

NameTypeRequiredDescription
imageImageRef { url? | base64? | id? }
Required
Image reference as URL or base64.
aspectstring
Required
Target aspect ratio, such as 1:1, 16:9
target"face" | "saliency"OptionalCrop focus target: face (face) or saliency (subject)
format"auto" | "webp" | "avif" | "jpeg" | "png" | "heic"OptionalOutput image format.
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

ProcessedImage { image_url, mime, width, height, bytes }
NameTypeDescription
image_idstringUnique identifier for this image
pattern: ^pim_[A-Za-z0-9]{20,}$
urlstringURL for this resource or endpoint
format"auto" | "webp" | "avif" | "jpeg" | "png" | "heic"Output or input format (e.g. json, csv, png)
widthintegerWidth of the image in pixels
≥ 1
heightintegerHeight of the image in pixels
≥ 1
size_bytesintegerSize of the resource in bytes
≥ 0
sha256stringSHA-256 hash of the resource content
pattern: ^[a-f0-9]{64}$
original_sha256string | nullSHA-256 hash of the original image before processing
ops_appliedstring[]List of image operations that were applied
cost_usdnumber | nullCost of this operation in USD
≥ 0
created_atstringISO 8601 timestamp when this resource was created
format: date-time

Example

One-time prep (each example is assumed to be complete):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."
bash
curl -X POST https://api.infrai.cc/v1/image/smart_crop \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"image": "sample", "aspect": "sample"}'

2.9image.rotate

POST /v1/image/rotate

Rotate image by angle

Parameters

NameTypeRequiredDescription
imageImageRef { url? | base64? | id? }
Required
Image reference as URL or base64.
degreesnumber
Required
Rotation angle (degrees)
auto_orientbooleanOptionalWhether to automatically correct the orientation according to EXIF ​​information
default: true
format"auto" | "webp" | "avif" | "jpeg" | "png" | "heic"OptionalOutput image format.
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

ProcessedImage { image_url, mime, width, height, bytes }
NameTypeDescription
image_idstringUnique identifier for this image
pattern: ^pim_[A-Za-z0-9]{20,}$
urlstringURL for this resource or endpoint
format"auto" | "webp" | "avif" | "jpeg" | "png" | "heic"Output or input format (e.g. json, csv, png)
widthintegerWidth of the image in pixels
≥ 1
heightintegerHeight of the image in pixels
≥ 1
size_bytesintegerSize of the resource in bytes
≥ 0
sha256stringSHA-256 hash of the resource content
pattern: ^[a-f0-9]{64}$
original_sha256string | nullSHA-256 hash of the original image before processing
ops_appliedstring[]List of image operations that were applied
cost_usdnumber | nullCost of this operation in USD
≥ 0
created_atstringISO 8601 timestamp when this resource was created
format: date-time

Example

One-time prep (each example is assumed to be complete):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."
bash
curl -X POST https://api.infrai.cc/v1/image/rotate \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"image": "sample", "degrees": 1.0}'

2.10image.compress

POST /v1/image/compress

Compress images by quality or target number of bytes

Parameters

NameTypeRequiredDescription
imageImageRef { url? | base64? | id? }
Required
Image reference as URL or base64.
qualitynumberOptionalCompression quality from 0 to 100.
1–100
target_bytesnumberOptionalThe upper limit of the target output bytes, used to limit the compressed size
≥ 1
format"auto" | "webp" | "avif" | "jpeg" | "png" | "heic"OptionalOutput image format.
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

ProcessedImage { image_url, mime, width, height, bytes }
NameTypeDescription
image_idstringUnique identifier for this image
pattern: ^pim_[A-Za-z0-9]{20,}$
urlstringURL for this resource or endpoint
format"auto" | "webp" | "avif" | "jpeg" | "png" | "heic"Output or input format (e.g. json, csv, png)
widthintegerWidth of the image in pixels
≥ 1
heightintegerHeight of the image in pixels
≥ 1
size_bytesintegerSize of the resource in bytes
≥ 0
sha256stringSHA-256 hash of the resource content
pattern: ^[a-f0-9]{64}$
original_sha256string | nullSHA-256 hash of the original image before processing
ops_appliedstring[]List of image operations that were applied
cost_usdnumber | nullCost of this operation in USD
≥ 0
created_atstringISO 8601 timestamp when this resource was created
format: date-time

Example

One-time prep (each example is assumed to be complete):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."
bash
curl -X POST https://api.infrai.cc/v1/image/compress \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"image": "sample"}'

2.11image.convert

POST /v1/image/convert

Recode the image to another format

Parameters

NameTypeRequiredDescription
imageImageRef { url? | base64? | id? }
Required
Image reference as URL or base64.
format"auto" | "webp" | "avif" | "jpeg" | "png" | "heic"
Required
Output image format.
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

ProcessedImage { image_url, mime, width, height, bytes }
NameTypeDescription
image_idstringUnique identifier for this image
pattern: ^pim_[A-Za-z0-9]{20,}$
urlstringURL for this resource or endpoint
format"auto" | "webp" | "avif" | "jpeg" | "png" | "heic"Output or input format (e.g. json, csv, png)
widthintegerWidth of the image in pixels
≥ 1
heightintegerHeight of the image in pixels
≥ 1
size_bytesintegerSize of the resource in bytes
≥ 0
sha256stringSHA-256 hash of the resource content
pattern: ^[a-f0-9]{64}$
original_sha256string | nullSHA-256 hash of the original image before processing
ops_appliedstring[]List of image operations that were applied
cost_usdnumber | nullCost of this operation in USD
≥ 0
created_atstringISO 8601 timestamp when this resource was created
format: date-time

Example

One-time prep (each example is assumed to be complete):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."
bash
curl -X POST https://api.infrai.cc/v1/image/convert \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"image": "sample", "format": "auto"}'

2.12image.watermark

POST /v1/image/watermark

Add text or image watermark to images

Parameters

NameTypeRequiredDescription
imageImageRef { url? | base64? | id? }
Required
Image reference as URL or base64.
textstringOptionalWatermark text content
watermark_imageImageRef { url? | base64? | id? }OptionalImage reference used as watermark (url/base64/id)
position"top_left" | "top" | "top_right" | "left" | "center" | "right" | "bottom_left" | "bottom" | "bottom_right"OptionalWatermark position: four corners or center
default: "bottom_right"
opacitynumberOptionalWatermark opacity, between 0 and 1
0–1default: 1
format"auto" | "webp" | "avif" | "jpeg" | "png" | "heic"OptionalOutput image format.
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

ProcessedImage { image_url, mime, width, height, bytes }
NameTypeDescription
image_idstringUnique identifier for this image
pattern: ^pim_[A-Za-z0-9]{20,}$
urlstringURL for this resource or endpoint
format"auto" | "webp" | "avif" | "jpeg" | "png" | "heic"Output or input format (e.g. json, csv, png)
widthintegerWidth of the image in pixels
≥ 1
heightintegerHeight of the image in pixels
≥ 1
size_bytesintegerSize of the resource in bytes
≥ 0
sha256stringSHA-256 hash of the resource content
pattern: ^[a-f0-9]{64}$
original_sha256string | nullSHA-256 hash of the original image before processing
ops_appliedstring[]List of image operations that were applied
cost_usdnumber | nullCost of this operation in USD
≥ 0
created_atstringISO 8601 timestamp when this resource was created
format: date-time

Example

One-time prep (each example is assumed to be complete):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."
bash
curl -X POST https://api.infrai.cc/v1/image/watermark \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"image": {"base64": "<...>"}, "text": "© Infrai", "position": "bottom_right", "opacity": 0.6}'

2.13image.background_remove

POST /v1/image/background_remove

AI cutout to remove picture background

Parameters

NameTypeRequiredDescription
imageImageRef { url? | base64? | id? }
Required
Image reference as URL or base64.
format"auto" | "webp" | "avif" | "jpeg" | "png" | "heic"OptionalOutput image format.
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

ProcessedImage { image_url, mime, width, height, bytes }
NameTypeDescription
image_idstringUnique identifier for this image
pattern: ^pim_[A-Za-z0-9]{20,}$
urlstringURL for this resource or endpoint
format"auto" | "webp" | "avif" | "jpeg" | "png" | "heic"Output or input format (e.g. json, csv, png)
widthintegerWidth of the image in pixels
≥ 1
heightintegerHeight of the image in pixels
≥ 1
size_bytesintegerSize of the resource in bytes
≥ 0
sha256stringSHA-256 hash of the resource content
pattern: ^[a-f0-9]{64}$
original_sha256string | nullSHA-256 hash of the original image before processing
ops_appliedstring[]List of image operations that were applied
cost_usdnumber | nullCost of this operation in USD
≥ 0
created_atstringISO 8601 timestamp when this resource was created
format: date-time

Example

One-time prep (each example is assumed to be complete):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."
bash
curl -X POST https://api.infrai.cc/v1/image/background_remove \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"image": "sample"}'

2.14image.transformation.create

POST /v1/image/transformation/create

Register a named image transformation template

Parameters

NameTypeRequiredDescription
namestring
Required
Transform template name for reuse in serving URLs
1–128 chars
transformImageTransform
Required
Image transformation parameter object (width, height, format, cropping, etc.)
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

ImageTransformation { id, name, transform, created_at }
NameTypeDescription
transformation_idstringUnique identifier for this transformation
pattern: ^imgtf_[A-Za-z0-9]{20,}$
namestringHuman-readable name for this resource
1–128 chars
transformobjectImage transformation specification
transform.winteger | nullTarget width.
≥ 1
transform.hinteger | nullTarget height.
≥ 1
transform.f"auto" | "webp" | "avif" | "jpeg" | "png" | "heic"Format for the output image
transform.qinteger | nullEncoder quality 1-100.
1–100
transform.fit"cover" | "contain" | "fill" | "inside" | "outside"Fit mode for resizing (cover, contain, fill, inside, outside)
created_atstringISO 8601 timestamp when this resource was created
format: date-time

Example

One-time prep (each example is assumed to be complete):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."
bash
curl -X POST https://api.infrai.cc/v1/image/transformation/create \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "example", "transform": {}}'

2.15image.transformation.list

GET /v1/image/transformation/list

List registered named image transform templates

Parameters

NameTypeRequiredDescription
cursorstringOptionalPaging cursor: Pass in the next_cursor returned from the previous page to get the next page.
limitnumberOptionalThe maximum number of items returned on a single page.

Returns

{ items: ImageTransformation[], next_cursor? }
NameTypeDescription
itemsobject[]Array of result items in this page
items[].transformation_idstringUnique identifier for this transformation
pattern: ^imgtf_[A-Za-z0-9]{20,}$
items[].namestringHuman-readable name for this resource
1–128 chars
items[].transformobjectImage transformation specification
items[].transform.winteger | nullTarget width.
≥ 1
items[].transform.hinteger | nullTarget height.
≥ 1
items[].transform.f"auto" | "webp" | "avif" | "jpeg" | "png" | "heic"Format for the output image
items[].transform.qinteger | nullEncoder quality 1-100.
1–100
items[].transform.fit"cover" | "contain" | "fill" | "inside" | "outside"Fit mode for resizing (cover, contain, fill, inside, outside)
items[].created_atstringISO 8601 timestamp when this resource was created
format: date-time
next_cursorstring | nullOpaque cursor to fetch the next page; null/absent if this is the last page

Example

One-time prep (each example is assumed to be complete):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."
bash
curl -X GET https://api.infrai.cc/v1/image/transformation/list \
  -H "Authorization: Bearer $INFRAI_API_KEY"

2.16image.batch.submit

POST /v1/image/batch/submit

Submit batch image processing tasks

Parameters

NameTypeRequiredDescription
itemsArray<{ image, ops }>
Required
Array of batch entries, each containing image and ops (processing steps)
≥ 1 item
webhook_urlstringOptionalWebhook address for callback notification when the task is completed
format: uri
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

ImageJob { id, status, count, created_at }
NameTypeDescription
job_idstringUnique identifier for this async job
pattern: ^imgjob_[A-Za-z0-9]{20,}$
status"queued" | "in_progress" | "completed" | "failed" | "cancelled"Current status of this resource
total_countintegerTotal number of items across all pages
≥ 1

Example

One-time prep (each example is assumed to be complete):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."
bash
curl -X POST https://api.infrai.cc/v1/image/batch/submit \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"items": [{"image": "sample", "ops": [{"op": "resize"}]}]}'

2.17image.batch.status

GET /v1/image/batch/status/{id}

Query the progress of batch image processing tasks

Parameters

NameTypeRequiredDescription
idstring
Required
batch processing task job id

Returns

ImageJob { id, status, count, done, failed, results? }
NameTypeDescription
job_idstringUnique identifier for this async job
pattern: ^imgjob_[A-Za-z0-9]{20,}$
status"queued" | "in_progress" | "completed" | "failed" | "cancelled"Current status of this resource
itemsobject[]Array of result items in this page
items[].indexinteger-
≥ 0
items[].status"queued" | "in_progress" | "completed" | "failed"-
items[].resultobject | null-
items[].result.image_idstringUnique identifier for this image
pattern: ^pim_[A-Za-z0-9]{20,}$
items[].result.urlstringURL for this resource or endpoint
items[].result.format"auto" | "webp" | "avif" | "jpeg" | "png" | "heic"Output or input format (e.g. json, csv, png)
items[].result.widthintegerWidth of the image in pixels
≥ 1
items[].result.heightintegerHeight of the image in pixels
≥ 1
items[].result.size_bytesintegerSize of the resource in bytes
≥ 0
items[].result.sha256stringSHA-256 hash of the resource content
pattern: ^[a-f0-9]{64}$
items[].result.original_sha256string | nullSHA-256 hash of the original image before processing
items[].result.ops_appliedstring[]List of image operations that were applied
items[].result.cost_usdnumber | nullCost of this operation in USD
≥ 0
items[].result.created_atstringISO 8601 timestamp when this resource was created
format: date-time
items[].errorstring | nullError code when this item failed.

Example

One-time prep (each example is assumed to be complete):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."
bash
curl -X GET https://api.infrai.cc/v1/image/batch/status/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY"

2.18image.batch.cancel

POST /v1/image/batch/cancel/{id}

Cancel batch image processing tasks

Parameters

NameTypeRequiredDescription
idstring
Required
The batch task job id to be canceled
idempotency_keystringOptionalOptional dedup key; identical retries return the same result.

Returns

ImageJob { id, status }
NameTypeDescription
cancelledbooleanWhether the resource was successfully cancelled
job_idstring | nullUnique identifier for this async job
pattern: ^imgjob_[A-Za-z0-9]{20,}$

Example

One-time prep (each example is assumed to be complete):

bash
# No SDK to install — every call is a plain HTTPS request.
# Get a project key by signing in at https://infrai.cc/login (Google/GitHub gives
# you $2 free credit; email sign-in starts at $0). On 402 INSUFFICIENT_CREDIT, add
# funds at https://infrai.cc/billing (or POST /v1/account/topup and open the
# returned checkout_url).
export INFRAI_API_KEY="ifr_..."
bash
curl -X POST https://api.infrai.cc/v1/image/batch/cancel/ID \
  -H "Authorization: Bearer $INFRAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"job_id": "sample"}'

3. All capabilities

Every routed capability in this module — the complete public REST contract. The methods above are the guided walkthrough; this index is the full reference.

image.background_removePOST /v1/image/background_remove

Transform an EXISTING image by AI-removing its background. To GENERATE images with AI use ai.image.

Parameters (3)
NameTypeRequiredDescription
imageobjectRequiredImage data or reference for processing
format"auto" | "webp" | "avif" | "jpeg" | "png" | "heic"OptionalOutput or input format (e.g. json, csv, png)
idempotency_keystring | nullOptionalClient-provided idempotency key; prevents duplicate execution on retry
image.batch.cancelPOST /v1/image/batch/cancel/{id}

Cancel a batch image-processing job by job ID; idempotent write.

Parameters (3)
NameTypeRequiredDescription
idstringRequiredPath parameter.
job_idstringRequiredId of the image batch job to cancel.
idempotency_keystring | nullOptionalClient-provided idempotency key; prevents duplicate execution on retry
image.batch.statusGET /v1/image/batch/status/{id}

Get the progress and results of a batch image-processing job by job ID.

Parameters (1)
NameTypeRequiredDescription
idstringRequiredPath parameter.
image.batch.submitPOST /v1/image/batch/submit

Submit a batch image-processing job and get a job handle, with optional webhook callback.

Parameters (4)
NameTypeRequiredDescription
itemsobject[]RequiredArray of result items in this page
≥ 1 item
webhook_urlstring | nullOptionalOptional completion callback; Infrai signs deliveries.
format: uri
idempotency_keystring | nullOptionalClient-provided idempotency key; prevents duplicate execution on retry
storebooleanOptionalOpt in to RETAIN the produced asset/record in Infrai's own store (default false = stateless passthrough: process, return inline, keep nothing). When true, Infrai persists the asset, bills a self-hosted storage line item and applies a retention TTL — and only then do the *.list/get/delete read caps see it.
default: false
image.compressPOST /v1/image/compress

Transform an EXISTING image by compressing it to a target quality or byte size, optionally re-encoding. To GENERATE images with AI use ai.image.

Parameters (6)
NameTypeRequiredDescription
imageobjectRequiredImage data or reference for processing
qualityinteger | nullOptionalEncoder quality 1-100; mutually informative with target_bytes.
1–100
target_bytesinteger | nullOptionalCompress to <= this byte budget via quality binary search.
≥ 1
format"auto" | "webp" | "avif" | "jpeg" | "png" | "heic"OptionalOutput or input format (e.g. json, csv, png)
idempotency_keystring | nullOptionalClient-provided idempotency key; prevents duplicate execution on retry
storebooleanOptionalOpt in to RETAIN the produced asset/record in Infrai's own store (default false = stateless passthrough: process, return inline, keep nothing). When true, Infrai persists the asset, bills a self-hosted storage line item and applies a retention TTL — and only then do the *.list/get/delete read caps see it.
default: false
image.convertPOST /v1/image/convert

Transform an EXISTING image by re-encoding it to another format (jpeg/png/webp/avif). To GENERATE images with AI use ai.image.

Parameters (4)
NameTypeRequiredDescription
imageobjectRequiredImage data or reference for processing
format"auto" | "webp" | "avif" | "jpeg" | "png" | "heic"RequiredOutput or input format (e.g. json, csv, png)
idempotency_keystring | nullOptionalClient-provided idempotency key; prevents duplicate execution on retry
storebooleanOptionalOpt in to RETAIN the produced asset/record in Infrai's own store (default false = stateless passthrough: process, return inline, keep nothing). When true, Infrai persists the asset, bills a self-hosted storage line item and applies a retention TTL — and only then do the *.list/get/delete read caps see it.
default: false
image.cropPOST /v1/image/crop

Transform an EXISTING image by cropping it to an x/y/w/h rectangle. To GENERATE images with AI use ai.image.

Parameters (8)
NameTypeRequiredDescription
imageobjectRequiredImage data or reference for processing
xintegerRequiredX coordinate for crop origin
≥ 0
yintegerRequiredY coordinate for crop origin
≥ 0
widthintegerRequiredWidth of the image in pixels
≥ 1
heightintegerRequiredHeight of the image in pixels
≥ 1
format"auto" | "webp" | "avif" | "jpeg" | "png" | "heic"OptionalOutput or input format (e.g. json, csv, png)
idempotency_keystring | nullOptionalClient-provided idempotency key; prevents duplicate execution on retry
storebooleanOptionalOpt in to RETAIN the produced asset/record in Infrai's own store (default false = stateless passthrough: process, return inline, keep nothing). When true, Infrai persists the asset, bills a self-hosted storage line item and applies a retention TTL — and only then do the *.list/get/delete read caps see it.
default: false
image.deleteDELETE /v1/image/delete/{id}

Delete a stored image asset by ID; idempotent write.

Parameters (1)
NameTypeRequiredDescription
idstringRequiredPath parameter.
image.getGET /v1/image/get/{id}

Get the metadata of one stored image asset (URL, MIME type, dimensions, byte size) by ID.

Parameters (1)
NameTypeRequiredDescription
idstringRequiredPath parameter.
image.metadataPOST /v1/image/metadata

Inspect an EXISTING image's metadata (dimensions, format, EXIF) without modifying it; read-only.

Parameters (1)
NameTypeRequiredDescription
imageobjectRequiredImage data or reference for processing
image.moderatePOST /v1/image/moderate

Classify an image for unsafe content (adult/violence/etc.) returning a flagged verdict plus per-category flags/scores. Real vendor dispatch: Google Vision SafeSearch, Aliyun Green image scan. service_markup applies.

Parameters (2)
NameTypeRequiredDescription
imagestringRequiredImage as data URI, URL, or base64.
vendor"google" | "aliyun"OptionalOptional vendor pin.
image.ocrPOST /v1/image/ocr

Extract text from an image (distinct from pdf.ocr) returning full text plus per-line blocks. Real vendor dispatch: Aliyun OCR, Baidu OCR, AWS Textract; self_hosted tesseract honestly degrades to a 503 when the binary is absent (no synthetic text).

Parameters (3)
NameTypeRequiredDescription
imagestringRequiredImage as data URI, URL, or base64.
languagestringOptionalOptional language hint (e.g. eng, chi_sim).
vendor"aliyun" | "baidu" | "aws" | "self_hosted"OptionalOptional vendor pin.
image.processPOST /v1/image/process

Transform an EXISTING image through a chained pipeline of ops, re-encoded once at the end. To GENERATE images with AI use ai.image.

Parameters (5)
NameTypeRequiredDescription
imageobjectRequiredThe source image, as either inline bytes (url/base64) or a stable asset reference (image_id).
opsobject[]RequiredOrdered list of image operations to apply
1–20 items
format"auto" | "webp" | "avif" | "jpeg" | "png" | "heic"OptionalOutput or input format (e.g. json, csv, png)
idempotency_keystring | nullOptionalClient-provided idempotency key; prevents duplicate execution on retry
storebooleanOptionalOpt in to RETAIN the produced asset/record in Infrai's own store (default false = stateless passthrough: process, return inline, keep nothing). When true, Infrai persists the asset, bills a self-hosted storage line item and applies a retention TTL — and only then do the *.list/get/delete read caps see it.
default: false
image.resizePOST /v1/image/resize

Transform an EXISTING image by resizing it with a fit mode and optional upscaling/format. To GENERATE images with AI use ai.image.

Parameters (8)
NameTypeRequiredDescription
imageobjectRequiredImage data or reference for processing
widthinteger | nullOptionalWidth of the image in pixels
≥ 1
heightinteger | nullOptionalHeight of the image in pixels
≥ 1
fit"cover" | "contain" | "fill" | "inside" | "outside"OptionalFit mode for resizing (cover, contain, fill, inside, outside)
enlargebooleanOptionalAllow upscaling beyond source dimensions; false (default) never upscales.
default: false
format"auto" | "webp" | "avif" | "jpeg" | "png" | "heic"OptionalOutput or input format (e.g. json, csv, png)
idempotency_keystring | nullOptionalClient-provided idempotency key; prevents duplicate execution on retry
storebooleanOptionalOpt in to RETAIN the produced asset/record in Infrai's own store (default false = stateless passthrough: process, return inline, keep nothing). When true, Infrai persists the asset, bills a self-hosted storage line item and applies a retention TTL — and only then do the *.list/get/delete read caps see it.
default: false
image.rotatePOST /v1/image/rotate

Transform an EXISTING image by rotating it, optionally auto-correcting orientation from EXIF. To GENERATE images with AI use ai.image.

Parameters (5)
NameTypeRequiredDescription
imageobjectRequiredImage data or reference for processing
degreesnumberRequiredClockwise rotation in degrees.
auto_orientbooleanOptionalApply EXIF orientation correction before rotating.
default: true
format"auto" | "webp" | "avif" | "jpeg" | "png" | "heic"OptionalOutput or input format (e.g. json, csv, png)
idempotency_keystring | nullOptionalClient-provided idempotency key; prevents duplicate execution on retry
image.smart_cropPOST /v1/image/smart_crop

Transform an EXISTING image with saliency-aware cropping to an aspect ratio, optionally targeting faces or subject. To GENERATE images with AI use ai.image.

Parameters (5)
NameTypeRequiredDescription
imageobjectRequiredImage data or reference for processing
aspectstringRequiredTarget aspect ratio, e.g. '1:1', '16:9'.
targetstring | nullOptionalSaliency target hint, e.g. 'face', 'auto'.
format"auto" | "webp" | "avif" | "jpeg" | "png" | "heic"OptionalOutput or input format (e.g. json, csv, png)
idempotency_keystring | nullOptionalClient-provided idempotency key; prevents duplicate execution on retry
image.tagPOST /v1/image/tag

Detect labels/objects in an image returning label + confidence pairs. Real vendor dispatch: Google Vision LABEL_DETECTION, AWS Rekognition DetectLabels. service_markup applies.

Parameters (3)
NameTypeRequiredDescription
imagestringRequiredImage as data URI, URL, or base64.
max_tagsintegerOptionalMaximum number of tags to return
≥ 1default: 10
vendor"google" | "aws"OptionalOptional vendor pin.
image.transformation.createPOST /v1/image/transformation/create

Register a named image-transformation template reusable in delivery URLs.

Parameters (3)
NameTypeRequiredDescription
namestringRequiredHuman-readable name for this resource
1–128 chars
transformobjectRequiredImage transformation specification
idempotency_keystring | nullOptionalClient-provided idempotency key; prevents duplicate execution on retry
image.transformation.listGET /v1/image/transformation/list

Page through the registered named image-transformation templates.

No request parameters.

image.uploadPOST /v1/image/upload

Upload an image and get an asset with an ID and URL for later processing.

Parameters (3)
NameTypeRequiredDescription
filestringRequiredbase64-encoded bytes (multipart is mapped to this field at the transport layer).
filenamestring | nullOptionalFilename for the uploaded image
idempotency_keystring | nullOptionalClient-provided idempotency key; prevents duplicate execution on retry
image.watermarkPOST /v1/image/watermark

Transform an EXISTING image by overlaying a text or image watermark with position and opacity. To GENERATE images with AI use ai.image.

Parameters (7)
NameTypeRequiredDescription
imageobjectRequiredImage data or reference for processing
textstring | nullOptionalText watermark content.
watermark_imageobject | nullOptionalImage watermark source (same ref shape as `image`); null when text is used.
position"top_left" | "top" | "top_right" | "left" | "center" | "right" | "bottom_left" | "bottom" | "bottom_right"OptionalPosition for the watermark (e.g. top-left, center)
default: "bottom_right"
opacitynumberOptionalWatermark opacity (0.0 to 1.0)
0–1default: 1
format"auto" | "webp" | "avif" | "jpeg" | "png" | "heic"OptionalOutput or input format (e.g. json, csv, png)
idempotency_keystring | nullOptionalClient-provided idempotency key; prevents duplicate execution on retry

4. End-to-end example

A production-style walkthrough of this module: configure once, then run the flow. It exercises most of the module's APIs.

A copy-paste-runnable single-file Python program (stdlib only, no SDK): set your INFRAI_API_KEY, run it, and walk this module's core flow with REAL billed calls — later steps reuse real fields returned by earlier ones. The 12-line helper is the entire integration.

python
#!/usr/bin/env python3
"""Infrai · image-process — runnable real-app example (single file, zero deps).

Copy this file, set your key, run it: every step is a REAL call to
api.infrai.cc, billed at the real (tiny) per-call price, printing the
live JSON response. Get a key at https://infrai.cc/login (Google/
GitHub sign-in grants $2 free credit); add funds at
https://infrai.cc/billing. No SDK — the 12-line helper below is the
entire integration."""
import json
import os
from urllib import error, request

KEY = os.environ.get("INFRAI_API_KEY") or "ifr_..."  # <- your key
BASE = "https://api.infrai.cc"


# Same raw HTTPS POST/GET as every per-method example on this page —
# wrapped once for reuse. There is nothing else to it: no SDK.
def infrai(method, path, body=None):
    req = request.Request(
        BASE + path, method=method,
        data=json.dumps(body).encode() if body is not None else None,
        headers={"Authorization": f"Bearer {KEY}",
                 "Content-Type": "application/json"})
    try:
        with request.urlopen(req, timeout=60) as r:
            return json.loads(r.read())
    except error.HTTPError as e:
        return json.loads(e.read())


def show(label, resp):
    print(f"\n== {label} ==")
    print(json.dumps(resp, indent=2, ensure_ascii=False))
    return resp


# 1) image.process — POST /v1/image/process · Transform an EXISTING image through a chained pipeline of ops, re-encoded once at the end. To GENERATE images with AI use ai.image.  # NOTE: non-trivial real cost
r1 = show("image.process", infrai("POST", "/v1/image/process", {"image":"sample","ops":[{"op":"resize"}]}))

# 2) image.metadata — POST /v1/image/metadata · Inspect an EXISTING image's metadata (dimensions, format, EXIF) without modifying it; read-only.
r2 = show("image.metadata", infrai("POST", "/v1/image/metadata", {"image":"sample"}))

5. Developer guides

Move from endpoint details to complete workflows, production patterns and troubleshooting guides verified against the live API.

Image Processing developer guides