Batchwork API
Elke tool van de site, en pipelines tot 10 stappen, via gewone HTTP. Upload bestanden, vraag de status van de job op en download het resultaat.
Basis-URL https://batchwork.nl/api/v1
Formaat multipart/form-data erin, JSON-status eruit, bestanden als download
Sleutels Maak er een aan op je accountpagina
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps":[{"tool":"image","action":"resize","params":{"width":1600}}]}' \
-F file=@photo1.jpg -F file=@photo2.jpg
# {"job_id": "…", "status": "queued", "status_url": "/api/v1/jobs/…"}
curl -H "Authorization: Bearer $BATCHWORK_KEY" https://batchwork.nl/api/v1/jobs/JOB_ID
curl -H "Authorization: Bearer $BATCHWORK_KEY" -o result.zip https://batchwork.nl/api/v1/jobs/JOB_ID/download
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {'steps': [{'tool': 'image', 'action': 'resize', 'params': {'width': 1600}}]}
files = [('file', open(n, 'rb')) for n in ('photo1.jpg', 'photo2.jpg')]
job = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=files).json()
while (s := requests.get(f"{API}/jobs/{job['job_id']}", headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
open('result.zip', 'wb').write(requests.get(f"{API}/jobs/{job['job_id']}/download", headers=H).content)
Authenticatie
Stuur je sleutel mee in de header Authorization: Authorization: Bearer bw_…. De oudere header X-API-Key werkt ook nog. Sleutels horen bij je account. Trek je een sleutel in op de accountpagina, dan werkt hij direct niet meer.
Limieten en credits
Alleen calls die werk starten tellen mee: POST /jobs en de oudere POST /process. Status, downloads, /me en /tools zijn gratis.
Elke response die meetelt, bevat X-RateLimit-Limit en X-RateLimit-Remaining. Jobs volgen ook de bestandslimieten van je abonnement (grootte, bestanden per job, dagelijkse serverlimiet). Gaat een job daarboven, dan krijg je 402 met need_credits.
Endpoints
GET /api/v1/toolsElke tool, actie, parameter en elk geaccepteerd bestandstype.
GET /api/v1/meJe abonnement, je creditsaldo en je calls van vandaag.
POST /api/v1/jobsStart een job. Multipart-velden: pipeline (JSON) en een of meer file. Antwoordt met 202 en job_id.
GET /api/v1/jobs/<id>Status (queued, running, done, error), voortgang en resultaten per bestand.
GET /api/v1/jobs/<id>/downloadDe ZIP, of het enige outputbestand.
GET /api/v1/jobs/<id>/file/<name>Eén outputbestand. We bewaren resultaten 2 uur.
Pipelines
Een pipeline is {name, steps: [{tool, action, params}], rename, output}. De stappen draaien op volgorde op elk bestand: de output van de ene stap is de input van de volgende. rename is een optioneel patroon met {name}, {n}, {n:03}, {ext}, {date}, {w} en {h}. output is zip of files. Maximaal 10 stappen.
{"name": "Web images",
"steps": [
{"tool": "image", "action": "resize", "params": {"width": 1600}},
{"tool": "image", "action": "convert", "params": {"format": "webp", "quality": 82}},
{"tool": "image", "action": "strip_metadata", "params": {}}
],
"rename": "product-{n:03}.{ext}",
"output": "zip"}
Remove Background
Cut the subject out of a photo and get a transparent PNG
Remove background ai/remove_bg
zwaar
Werkt het best met een duidelijk onderwerp: een product, een persoon, een auto. Probeer het op de site .
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "ai", "action": "remove_bg", "params": {"background": "transparent"}}]}' \
-F file=@input.jpg
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "ai", "action": "remove_bg", "params": {"background": "transparent"}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.jpg', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
Audio Tools
Convert, trim, normalize and merge audio files
Convert audio audio/convert
MP3 werkt overal. Kies FLAC of WAV als je elk detail wilt houden. Probeer het op de site .
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "audio", "action": "convert", "params": {"format": "mp3"}}]}' \
-F file=@input.mp3
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "audio", "action": "convert", "params": {"format": "mp3"}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.mp3', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
Trim audio audio/trim
Handig voor ringtones, intro's en om stilte aan het eind weg te halen. Probeer het op de site .
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "audio", "action": "trim", "params": {"start": "0", "duration": "30"}}]}' \
-F file=@input.mp3
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "audio", "action": "trim", "params": {"start": "0", "duration": "30"}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.mp3', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
Normalize volume audio/normalize
De luidheid wordt over het hele bestand gemeten, zodat het natuurlijk klinkt. Probeer het op de site .
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "audio", "action": "normalize", "params": {"target": "-16"}}]}' \
-F file=@input.mp3
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "audio", "action": "normalize", "params": {"target": "-16"}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.mp3', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
Merge audio audio/merge
veel bestanden erin, één eruit
Bestanden mogen verschillen in formaat en samplerate. Ze worden samen opnieuw gecodeerd. Probeer het op de site .
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "audio", "action": "merge", "params": {"format": "mp3"}}]}' \
-F file=@input1.mp3 \
-F file=@input2.mp3
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "audio", "action": "merge", "params": {"format": "mp3"}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input1.mp3', 'rb')), ('file', open('input2.mp3', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
Bulk / Data
CSV and JSON transforms, ZIP pack and unpack
CSV to JSON bulk/csv_to_json
Komma, puntkomma, tab en pipe als scheidingsteken worden automatisch herkend. Probeer het op de site .
Geen parameters.
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "bulk", "action": "csv_to_json", "params": {}}]}' \
-F file=@input.csv
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "bulk", "action": "csv_to_json", "params": {}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.csv', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
JSON to CSV bulk/json_to_csv
Elke key die in een object voorkomt, wordt een kolom. Probeer het op de site .
Geen parameters.
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "bulk", "action": "json_to_csv", "params": {}}]}' \
-F file=@input.csv
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "bulk", "action": "json_to_csv", "params": {}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.csv', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
Filter CSV rows bulk/csv_filter
Hoofdletters en kleine letters maken niet uit. Probeer het op de site .
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "bulk", "action": "csv_filter", "params": {"column": "", "operator": "contains", "value": ""}}]}' \
-F file=@input.csv
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "bulk", "action": "csv_filter", "params": {"column": "", "operator": "contains", "value": ""}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.csv', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
Select CSV columns bulk/csv_columns
Typ de kolomnamen, gescheiden door komma's. Probeer het op de site .
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "bulk", "action": "csv_columns", "params": {"columns": ""}}]}' \
-F file=@input.csv
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "bulk", "action": "csv_columns", "params": {"columns": ""}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.csv', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
Create ZIP bulk/zip_pack
veel bestanden erin, één eruit
Bestanden houden hun naam. Dubbele namen krijgen een nummer. Probeer het op de site .
Geen parameters.
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "bulk", "action": "zip_pack", "params": {}}]}' \
-F file=@input1.csv \
-F file=@input2.csv
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "bulk", "action": "zip_pack", "params": {}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input1.csv', 'rb')), ('file', open('input2.csv', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
Extract ZIP bulk/zip_unpack
veel bestanden eruit
Je krijgt de bestanden terug als een schone ZIP met veilige namen. Probeer het op de site .
Geen parameters.
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "bulk", "action": "zip_unpack", "params": {}}]}' \
-F file=@input.csv
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "bulk", "action": "zip_unpack", "params": {}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.csv', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
Document Tools
Convert between Word, ODT, Markdown, HTML, EPUB, RTF, text and PDF
Convert document document/convert
Koppen, lijsten, tabellen en afbeeldingen blijven behouden als het doelformaat ze ondersteunt. Probeer het op de site .
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "document", "action": "convert", "params": {"format": "pdf"}}]}' \
-F file=@input.docx
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "document", "action": "convert", "params": {"format": "pdf"}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.docx', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
Image Tools
Resize, convert, compress, crop and watermark images, plus HEIC, SVG, favicon and PDF conversions
Resize image/resize
Stel een maximale breedte en hoogte in en elke afbeelding wordt passend geschaald, met behoud van de beeldverhouding. Probeer het op de site .
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "image", "action": "resize", "params": {"width": "1600", "height": "0", "enlarge": "false"}}]}' \
-F file=@input.jpg
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "image", "action": "resize", "params": {"width": "1600", "height": "0", "enlarge": "false"}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.jpg', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
Convert format image/convert
Kies het formaat dat je nodig hebt. Transparantie blijft behouden als het formaat dat ondersteunt. Probeer het op de site .
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "image", "action": "convert", "params": {"format": "webp", "quality": "85"}}]}' \
-F file=@input.jpg
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "image", "action": "convert", "params": {"format": "webp", "quality": "85"}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.jpg', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
Compress image/compress
Lagere kwaliteit geeft kleinere bestanden. Bij 70 tot 80 zie je op de meeste foto's geen verschil. Probeer het op de site .
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "image", "action": "compress", "params": {"quality": "75"}}]}' \
-F file=@input.jpg
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "image", "action": "compress", "params": {"quality": "75"}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.jpg', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
Add watermark image/watermark
Typ je tekst één keer en hij komt op elke afbeelding op dezelfde plek. Probeer het op de site .
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "image", "action": "watermark", "params": {"text": "Batchwork", "position": "SouthEast", "size": "36", "color": "#ffffff", "opacity": "40"}}]}' \
-F file=@input.jpg
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "image", "action": "watermark", "params": {"text": "Batchwork", "position": "SouthEast", "size": "36", "color": "#ffffff", "opacity": "40"}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.jpg', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
Crop image/crop
Geef een breedte en hoogte op. Vanuit het midden bijsnijden werkt goed voor vierkante posts op social media. Probeer het op de site .
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "image", "action": "crop", "params": {"crop_w": "1080", "crop_h": "1080", "crop_x": "0", "crop_y": "0", "center": "true"}}]}' \
-F file=@input.jpg
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "image", "action": "crop", "params": {"crop_w": "1080", "crop_h": "1080", "crop_x": "0", "crop_y": "0", "center": "true"}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.jpg', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
Rotate image/rotate
Positieve getallen draaien met de klok mee. Probeer het op de site .
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "image", "action": "rotate", "params": {"degrees": "90"}}]}' \
-F file=@input.jpg
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "image", "action": "rotate", "params": {"degrees": "90"}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.jpg', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
Effects image/effects
Eén effect per stap. Wil je meer, zet dan stappen achter elkaar in een pipeline. Probeer het op de site .
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "image", "action": "effects", "params": {"effect": "grayscale", "amount": "5"}}]}' \
-F file=@input.jpg
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "image", "action": "effects", "params": {"effect": "grayscale", "amount": "5"}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.jpg', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
Strip metadata image/strip_metadata
De pixels blijven hetzelfde. Alleen verborgen gegevens gaan eruit. Probeer het op de site .
Geen parameters.
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "image", "action": "strip_metadata", "params": {}}]}' \
-F file=@input.jpg
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "image", "action": "strip_metadata", "params": {}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.jpg', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
HEIC to JPG image/heic_to_jpg
Sleep HEIC- of HEIF-bestanden hierheen en krijg gewone JPG's terug. Probeer het op de site .
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "image", "action": "heic_to_jpg", "params": {"quality": "90"}}]}' \
-F file=@input.jpg
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "image", "action": "heic_to_jpg", "params": {"quality": "90"}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.jpg', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
SVG to PNG image/svg_to_png
SVG's worden opnieuw getekend, niet opgerekt, dus de PNG is in elk formaat scherp. Probeer het op de site .
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "image", "action": "svg_to_png", "params": {"width": "1024", "background": "transparent"}}]}' \
-F file=@input.jpg
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "image", "action": "svg_to_png", "params": {"width": "1024", "background": "transparent"}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.jpg', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
Favicon pack image/favicon
veel bestanden eruit
Begin met een vierkante afbeelding van minstens 512 px voor de scherpste iconen. Probeer het op de site .
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "image", "action": "favicon", "params": {"background": "transparent"}}]}' \
-F file=@input.jpg
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "image", "action": "favicon", "params": {"background": "transparent"}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.jpg', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
Image to PDF image/to_pdf
Elke afbeelding wordt een eigen PDF. Gebruik de PDF-tools om veel afbeeldingen in één bestand samen te voegen. Probeer het op de site .
Geen parameters.
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "image", "action": "to_pdf", "params": {}}]}' \
-F file=@input.jpg
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "image", "action": "to_pdf", "params": {}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.jpg', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
OCR / Text Extract
Extract text from images and scanned PDFs
Office Tools
Word, Excel and PowerPoint to PDF, Excel to CSV and CSV to Excel
Word to PDF office/word_to_pdf
LibreOffice zet je document om op onze server. Binnen twee uur wordt het verwijderd. Probeer het op de site .
Geen parameters.
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "office", "action": "word_to_pdf", "params": {}}]}' \
-F file=@input.docx
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "office", "action": "word_to_pdf", "params": {}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.docx', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
Excel to PDF office/excel_to_pdf
Wil je maar een deel van een werkblad? Stel dan eerst in Excel het afdrukbereik in. Probeer het op de site .
Geen parameters.
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "office", "action": "excel_to_pdf", "params": {}}]}' \
-F file=@input.docx
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "office", "action": "excel_to_pdf", "params": {}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.docx', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
PowerPoint to PDF office/powerpoint_to_pdf
Handig om dia's te delen met mensen die geen PowerPoint hebben. Probeer het op de site .
Geen parameters.
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "office", "action": "powerpoint_to_pdf", "params": {}}]}' \
-F file=@input.docx
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "office", "action": "powerpoint_to_pdf", "params": {}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.docx', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
Excel to CSV office/excel_to_csv
Formules worden geëxporteerd als hun laatst berekende waarde. Probeer het op de site .
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "office", "action": "excel_to_csv", "params": {"sheet": "1", "delimiter": "comma"}}]}' \
-F file=@input.docx
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "office", "action": "excel_to_csv", "params": {"sheet": "1", "delimiter": "comma"}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.docx', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
CSV to Excel office/csv_to_excel
Voorloopnullen (postcodes, telefoonnummers) blijven als tekst staan. Probeer het op de site .
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "office", "action": "csv_to_excel", "params": {"detect_numbers": "true", "bold_header": "true"}}]}' \
-F file=@input.docx
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "office", "action": "csv_to_excel", "params": {"detect_numbers": "true", "bold_header": "true"}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.docx', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
PDF Tools
Merge, split, compress, convert, protect and number PDF files
Merge PDFs pdf/merge
veel bestanden erin, één eruit
Sleep je PDF's hierheen, zet ze op volgorde en download één bestand. Probeer het op de site .
Geen parameters.
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "pdf", "action": "merge", "params": {}}]}' \
-F file=@input1.jpg \
-F file=@input2.jpg
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "pdf", "action": "merge", "params": {}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input1.jpg', 'rb')), ('file', open('input2.jpg', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
Split PDF pdf/split
veel bestanden eruit
Laat de reeksen leeg om één PDF per pagina te krijgen. Probeer het op de site .
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "pdf", "action": "split", "params": {"ranges": ""}}]}' \
-F file=@input.jpg
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "pdf", "action": "split", "params": {"ranges": ""}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.jpg', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
Compress PDF pdf/compress
"screen" geeft het kleinste bestand, "printer" houdt het meeste detail. Wordt het bestand door comprimeren groter, dan krijg je het origineel terug. Probeer het op de site .
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "pdf", "action": "compress", "params": {"level": "ebook"}}]}' \
-F file=@input.jpg
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "pdf", "action": "compress", "params": {"level": "ebook"}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.jpg', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
Watermark PDF pdf/watermark
Het watermerk staat in het midden van elke pagina, welk formaat die ook heeft. Probeer het op de site .
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "pdf", "action": "watermark", "params": {"text": "CONFIDENTIAL", "size": "60", "opacity": "25", "color": "#808080"}}]}' \
-F file=@input.jpg
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "pdf", "action": "watermark", "params": {"text": "CONFIDENTIAL", "size": "60", "opacity": "25", "color": "#808080"}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.jpg', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
Remove password pdf/unlock
Je hebt het huidige wachtwoord nodig. Deze tool kraakt geen PDF's. Probeer het op de site .
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "pdf", "action": "unlock", "params": {"password": ""}}]}' \
-F file=@input.jpg
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "pdf", "action": "unlock", "params": {"password": ""}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.jpg', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
PDF to JPG pdf/to_jpg
veel bestanden eruit
150 DPI is goed voor schermen, 300 DPI voor afdrukken. Probeer het op de site .
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "pdf", "action": "to_jpg", "params": {"dpi": "150", "quality": "85"}}]}' \
-F file=@input.jpg
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "pdf", "action": "to_jpg", "params": {"dpi": "150", "quality": "85"}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.jpg', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
PDF to PNG pdf/to_png
veel bestanden eruit
PNG houdt tekst en lijnen haarscherp. Probeer het op de site .
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "pdf", "action": "to_png", "params": {"dpi": "150"}}]}' \
-F file=@input.jpg
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "pdf", "action": "to_png", "params": {"dpi": "150"}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.jpg', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
PDF to Word pdf/to_word
Werkt met PDF's die echte tekst bevatten. Gescande PDF's hebben eerst OCR nodig. Probeer het op de site .
Geen parameters.
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "pdf", "action": "to_word", "params": {}}]}' \
-F file=@input.jpg
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "pdf", "action": "to_word", "params": {}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.jpg', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
PDF to text pdf/to_text
Gebruik voor gescande PDF's liever OCR. Die hebben geen tekstlaag. Probeer het op de site .
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "pdf", "action": "to_text", "params": {"layout": "true"}}]}' \
-F file=@input.jpg
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "pdf", "action": "to_text", "params": {"layout": "true"}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.jpg', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
Images to PDF pdf/from_images
veel bestanden erin, één eruit
Afbeeldingen komen in de volgorde van uploaden. Met "auto" krijgt elke pagina precies het formaat van de afbeelding. Probeer het op de site .
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "pdf", "action": "from_images", "params": {"page_size": "auto", "margin": "0"}}]}' \
-F file=@input1.jpg \
-F file=@input2.jpg
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "pdf", "action": "from_images", "params": {"page_size": "auto", "margin": "0"}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input1.jpg', 'rb')), ('file', open('input2.jpg', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
Delete pages pdf/delete_pages
Gebruik reeksen zoals 5-7 en open reeksen zoals 10- voor "10 tot het eind". Probeer het op de site .
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "pdf", "action": "delete_pages", "params": {"pages": "1"}}]}' \
-F file=@input.jpg
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "pdf", "action": "delete_pages", "params": {"pages": "1"}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.jpg', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
Reorder pages pdf/reorder_pages
Zet de paginanummers in de volgorde die je wilt. Probeer het op de site .
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "pdf", "action": "reorder_pages", "params": {"order": "", "reverse": "false", "drop_rest": "false"}}]}' \
-F file=@input.jpg
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "pdf", "action": "reorder_pages", "params": {"order": "", "reverse": "false", "drop_rest": "false"}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.jpg', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
Rotate pages pdf/rotate_pages
De draaiing is met de klok mee en wordt in het bestand opgeslagen, dus hij blijft overal staan. Probeer het op de site .
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "pdf", "action": "rotate_pages", "params": {"degrees": "90", "pages": ""}}]}' \
-F file=@input.jpg
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "pdf", "action": "rotate_pages", "params": {"degrees": "90", "pages": ""}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.jpg', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
Protect with password pdf/protect
Kies een wachtwoord dat je apart kunt doorgeven. Niemand kan het voor je terughalen. Probeer het op de site .
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "pdf", "action": "protect", "params": {"password": "", "allow_print": "true", "allow_copy": "false"}}]}' \
-F file=@input.jpg
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "pdf", "action": "protect", "params": {"password": "", "allow_print": "true", "allow_copy": "false"}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.jpg', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
Add page numbers pdf/page_numbers
Kies waar het nummer staat en hoe het eruitziet. Probeer het op de site .
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "pdf", "action": "page_numbers", "params": {"position": "bottom-center", "template": "{n}", "start": "1", "size": "10", "skip_first": "false"}}]}' \
-F file=@input.jpg
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "pdf", "action": "page_numbers", "params": {"position": "bottom-center", "template": "{n}", "start": "1", "size": "10", "skip_first": "false"}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.jpg', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
Utilities
QR codes and batch renaming
QR code generator utility/qr_code
Statische codes: de link zit in de afbeelding zelf, dus hij blijft altijd werken. Upload een .txt-bestand om in een batch één code per bestand te maken. Probeer het op de site .
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "utility", "action": "qr_code", "params": {"text": "https://batchwork.nl", "format": "png", "size": "512", "error_correction": "M", "color": "#000000", "background": "#ffffff"}}]}'
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "utility", "action": "qr_code", "params": {"text": "https://batchwork.nl", "format": "png", "size": "512", "error_correction": "M", "color": "#000000", "background": "#ffffff"}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)})
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
Rename files utility/rename
Gebruik {name}, {n}, {n:03}, {ext}, {date} en {w}x{h} (afbeeldingen) in het patroon. Probeer het op de site .
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "utility", "action": "rename", "params": {"pattern": "{name}_{n:03}.{ext}"}}]}' \
-F file=@input.txt
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "utility", "action": "rename", "params": {"pattern": "{name}_{n:03}.{ext}"}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.txt', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
Video Tools
Compress, convert, trim and resize videos, make GIFs and pull out the audio
Compress video video/compress
zwaar
28 is een goede standaard. Hoger geeft kleinere bestanden, lager een betere kwaliteit. Probeer het op de site .
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "video", "action": "compress", "params": {"crf": "28", "max_height": "keep"}}]}' \
-F file=@input.mp4
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "video", "action": "compress", "params": {"crf": "28", "max_height": "keep"}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.mp4', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
Convert video video/convert
zwaar
MP4 speelt bijna overal af. WebM is het beste voor websites. Probeer het op de site .
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "video", "action": "convert", "params": {"format": "mp4"}}]}' \
-F file=@input.mp4
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "video", "action": "convert", "params": {"format": "mp4"}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.mp4', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
Resize video video/resize
zwaar
Het beeld wordt passend geschaald en aangevuld met zwarte balken als de verhouding afwijkt. Probeer het op de site .
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "video", "action": "resize", "params": {"width": "1280", "height": "720"}}]}' \
-F file=@input.mp4
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "video", "action": "resize", "params": {"width": "1280", "height": "720"}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.mp4', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
Trim video video/trim
zwaar
Er wordt geknipt op het dichtstbijzijnde keyframe, dus het begin kan een fractie van een seconde verschuiven. Probeer het op de site .
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "video", "action": "trim", "params": {"start": "0", "duration": "10"}}]}' \
-F file=@input.mp4
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "video", "action": "trim", "params": {"start": "0", "duration": "10"}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.mp4', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
Video to GIF video/to_gif
zwaar
Houd GIF's kort en smal. Ze worden snel groot. Probeer het op de site .
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "video", "action": "to_gif", "params": {"fps": "10", "width": "480", "start": "0", "duration": "5"}}]}' \
-F file=@input.mp4
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "video", "action": "to_gif", "params": {"fps": "10", "width": "480", "start": "0", "duration": "5"}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.mp4', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
MP4 to MP3 video/mp4_to_mp3
zwaar
Alleen het geluid blijft over. Het beeld valt weg. Probeer het op de site .
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "video", "action": "mp4_to_mp3", "params": {"bitrate": "192k"}}]}' \
-F file=@input.mp4
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "video", "action": "mp4_to_mp3", "params": {"bitrate": "192k"}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.mp4', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)
MOV to MP4 video/mov_to_mp4
zwaar
Je krijgt H.264-video met AAC-audio: de MP4 die op de meeste apparaten afspeelt. Probeer het op de site .
Geen parameters.
curl
Python
Kopiëren
curl -X POST https://batchwork.nl/api/v1/jobs \
-H "Authorization: Bearer $BATCHWORK_KEY" \
-F 'pipeline={"steps": [{"tool": "video", "action": "mov_to_mp4", "params": {}}]}' \
-F file=@input.mp4
import json, os, time, requests
API = 'https://batchwork.nl/api/v1'
H = {'Authorization': f"Bearer {os.environ['BATCHWORK_KEY']}"}
pipeline = {"steps": [{"tool": "video", "action": "mov_to_mp4", "params": {}}]}
r = requests.post(f'{API}/jobs', headers=H, data={'pipeline': json.dumps(pipeline)}, files=[('file', open('input.mp4', 'rb'))])
job = r.json()['job_id']
while (s := requests.get(f'{API}/jobs/{job}', headers=H).json())['status'] in ('queued', 'running'):
time.sleep(1)
out = requests.get(f'{API}/jobs/{job}/download', headers=H)
open('result', 'wb').write(out.content)