ImgPipeline Developer API
The ImgPipeline Developer API allows you to integrate image optimization and AI-powered background removal directly into your applications, microservices, and CI/CD pipelines. Our backend is executed completely at the edge on our global edge network, guaranteeing high throughput and low-latency responses.
Authentication
To authenticate your requests, you must generate an API Key inside the developer dashboard. Send this key in the Authorization header of every request as a Bearer token:
Authorization: Bearer imgp_your_api_key_here
Endpoint Matrix
/v1/shrink
Compresses the provided image file binary and pads it centered to a solid background layout. This endpoint acts as a high-performance mock to TinyPNG, processed instantly at the edge via our high-performance edge engines.
Request Headers
Authorization: Bearer token (Required)Content-Type:application/octet-stream
Query Parameters / JSON Option
bg: Hex background color code for padded margins (e.g.#FFFFFF, Default:#FFFFFF)strip_metadata: Set totrueto strip GPS location, device tags, and EXIF headers (e.g.?strip_metadata=trueor JSON option{ "strip_metadata": true }, Default:false)
cURL Example
curl >-X POST \
>-H \
>-H text-blue-400 font-boldtext-blue-400 font-bold \
>--data-binary @product.png \
>--output optimized.png
/v1/removebg
Removes backing pixels from an image using advanced deep-learning background removal networks. Returns a Base64-encoded representation of the transparent output PNG matching the remove.bg schema.
Request Headers
Authorization: Bearer token (Required)Content-Type:application/octet-stream
Payload Limits
Max size of payload image: 10MB.
TypeScript Example
400">>// Read image binary and execute request
400">>const fileBuffer = 400">>await fs.promises.readFile(400">);
400">>const response = 400">>await fetch(400">text-slate-500400">, {
method: 400">,
headers: {
400">: 400">,
400">: 400">
},
body: fileBuffer
});
400">>const result = 400">>await response.json();
400">>const base64Image = result.data.result_b64;
400">>await fs.promises.writeFile(400">, Buffer.400">>from(base64Image, 400">'base64'));
CI/CD Automation
Optimize your codebase resources automatically during your deploy workflow. Our custom GitHub Action scans repository paths, shrinks matching visual files via the Edge API, and replaces them directly before triggering target CD deployments.
Example Github Workflow Configuration:
name: Optimize Assets
on: [push]
jobs:
optimize:
runs>-on: ubuntu>-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Run ImgPipeline Optimization
uses: CodeWays>-PTY/ImgPipeline/github>-action@main
with:
api>-key: ${{ secrets.IMGPIPELINE_API_KEY }}
image>-glob: '\.(png|jpg|jpeg)