Skip to content

Image optimization

You chain up to 10 image operations in a single job. Splixir checks the output before delivery and charges $0.002 per delivered image. See the Image reference for every field and limit.

Combine resize with fit: "inside" and withoutEnlargement: true to scale down large photos without distorting aspect ratios or upscaling small sources.

Terminal window
curl -X POST https://api.splixir.com/v1/jobs \
-H "Authorization: Bearer $SPLIXIR_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: hero-1600-webp" \
-d '{
"kind": "image",
"input": "https://cdn.example.com/hero.jpg",
"operations": [
{ "type": "resize", "width": 1600, "fit": "inside", "withoutEnlargement": true },
{ "type": "convert", "format": "webp", "quality": 82 }
],
"output": { "format": "webp" },
"wait": true
}'

Use crop with mode: "aspect" and gravity: "smart" to frame subjects for 1:1, 16:9, or 9:16 cards, then resize to exact target pixels.

Terminal window
curl -X POST https://api.splixir.com/v1/jobs \
-H "Authorization: Bearer $SPLIXIR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"kind": "image",
"input": "https://cdn.example.com/photo.jpg",
"operations": [
{ "type": "crop", "mode": "aspect", "aspectRatio": "1:1", "gravity": "smart" },
{ "type": "resize", "width": 1080, "height": 1080, "fit": "cover" },
{ "type": "convert", "format": "webp", "quality": 85 }
],
"output": { "format": "webp" },
"wait": true
}'

Flatten transparency to a solid background

Section titled “Flatten transparency to a solid background”

When converting a transparent png or svg to jpeg, set background to a hex color such as #ffffff so transparent pixels fill cleanly instead of turning black.

Terminal window
curl -X POST https://api.splixir.com/v1/jobs \
-H "Authorization: Bearer $SPLIXIR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"kind": "image",
"input": "https://cdn.example.com/logo.svg",
"operations": [
{ "type": "convert", "format": "jpeg", "quality": 90, "background": "#ffffff" }
],
"output": { "format": "jpeg", "background": "#ffffff" },
"wait": true
}'

Add a watermark operation to render text over preview assets with control over position, opacity, fontSize, color, and margin.

Terminal window
curl -X POST https://api.splixir.com/v1/jobs \
-H "Authorization: Bearer $SPLIXIR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"kind": "image",
"input": "https://cdn.example.com/preview.jpg",
"operations": [
{ "type": "watermark", "text": "Preview", "position": "bottom-right", "opacity": 0.5, "fontSize": 28, "color": "#FFFFFF", "margin": 20 },
{ "type": "convert", "format": "webp", "quality": 80 }
],
"output": { "format": "webp" },
"wait": true
}'

Strip EXIF metadata while keeping orientation

Section titled “Strip EXIF metadata while keeping orientation”

Use strip_metadata with keepOrientation: true and keepColorProfile: true to remove GPS coordinates and camera EXIF fields without rotating portrait photos or shifting colors.

Terminal window
curl -X POST https://api.splixir.com/v1/jobs \
-H "Authorization: Bearer $SPLIXIR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"kind": "image",
"input": "https://cdn.example.com/camera.heic",
"operations": [
{ "type": "resize", "height": 1600, "fit": "inside", "withoutEnlargement": true },
{ "type": "strip_metadata", "keepOrientation": true, "keepColorProfile": true },
{ "type": "convert", "format": "avif", "quality": 75 }
],
"output": { "format": "avif" },
"wait": true
}'