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.
Convert images for responsive layouts
Section titled “Convert images for responsive layouts”Combine resize with fit: "inside" and withoutEnlargement: true to scale down large photos without distorting aspect ratios or upscaling small sources.
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 }'const res = await fetch("https://api.splixir.com/v1/jobs", { method: "POST", headers: { Authorization: `Bearer ${process.env.SPLIXIR_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ 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, }),});const job = await res.json();console.log(job.output.downloadUrl);import osimport requests
res = requests.post( "https://api.splixir.com/v1/jobs", headers={ "Authorization": f"Bearer {os.environ['SPLIXIR_API_KEY']}", "Content-Type": "application/json", }, json={ "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, },)print(res.json()["output"]["downloadUrl"])splixir image https://cdn.example.com/hero.jpg --resize 1600x --fit inside --format webp --quality 82 -o ./hero.webpCrop social thumbnails by aspect ratio
Section titled “Crop social thumbnails by aspect ratio”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.
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 }'const res = await fetch("https://api.splixir.com/v1/jobs", { method: "POST", headers: { Authorization: `Bearer ${process.env.SPLIXIR_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ 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, }),});import osimport requests
res = requests.post( "https://api.splixir.com/v1/jobs", headers={"Authorization": f"Bearer {os.environ['SPLIXIR_API_KEY']}"}, json={ "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, },)splixir image https://cdn.example.com/photo.jpg --aspect 1:1 --gravity smart --resize 1080x1080 --fit cover --format webp --quality 85 -o ./thumb.webpFlatten 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.
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 }'const res = await fetch("https://api.splixir.com/v1/jobs", { method: "POST", headers: { Authorization: `Bearer ${process.env.SPLIXIR_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ 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, }),});import osimport requests
res = requests.post( "https://api.splixir.com/v1/jobs", headers={"Authorization": f"Bearer {os.environ['SPLIXIR_API_KEY']}"}, json={ "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, },)splixir image https://cdn.example.com/logo.svg --background "#ffffff" --format jpeg --quality 90 -o ./logo.jpgAdd watermarks to protect previews
Section titled “Add watermarks to protect previews”Add a watermark operation to render text over preview assets with control over position, opacity, fontSize, color, and margin.
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 }'const res = await fetch("https://api.splixir.com/v1/jobs", { method: "POST", headers: { Authorization: `Bearer ${process.env.SPLIXIR_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ 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, }),});import osimport requests
res = requests.post( "https://api.splixir.com/v1/jobs", headers={"Authorization": f"Bearer {os.environ['SPLIXIR_API_KEY']}"}, json={ "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, },)splixir image https://cdn.example.com/preview.jpg --watermark "Preview" --watermark-pos bottom-right --watermark-opacity 0.5 --format webp --quality 80 -o ./preview.webpStrip 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.
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 }'const res = await fetch("https://api.splixir.com/v1/jobs", { method: "POST", headers: { Authorization: `Bearer ${process.env.SPLIXIR_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ 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, }),});import osimport requests
res = requests.post( "https://api.splixir.com/v1/jobs", headers={"Authorization": f"Bearer {os.environ['SPLIXIR_API_KEY']}"}, json={ "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, },)splixir image ./photo.heic --resize x1600 --fit inside --strip --format avif --quality 75 -o ./photo.avif