API JPEG pour les développeurs

Implémentez l'API de conversion JPEG.to pour convertir n'importe quelle image en PDF, PNG, ICO, SVG, JPG, BMP, DOCS, DOC, etc. ou pour convertir n'importe quel fichier en image.


* Nous ajoutons plus de fonctionnalités. Veuillez consulter notre documentation API pour plus d'informations


Obtenir la clé API →
curl -POST 'https://jpeg.to/v1/api' \
-F 'data=@/testing.pdf' \
-F 'data={"convert_to": "jpeg"}' \
-H 'Authorization: <YOUR_API_KEY>' \
--output file.jpeg
<?php
    $post_data = array(
        "data" => "{\"convert_to\": \"jpeg\"}",
        "file_contents" => curl_file_create("file.pdf")
    );
    $fp = fopen("file.jpeg", "w+");
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, "https://jpeg.to/v1/api");
    curl_setopt($curl, CURLOPT_HTTPHEADER, array(
        "Authorization: <YOUR_API_KEY>"
    ));
    curl_setopt($curl, CURLOPT_POST, 1);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data);
    curl_setopt($curl, CURLOPT_FILE, $fp);
    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
    $content = curl_exec($curl);
    curl_close($curl);
    fclose($fp);
?>
import requests
import json

url = 'https://jpeg.to/v1/api'
files = {'file': open('testing.pdf', 'rb')}
params = {'convert_to': 'jpeg'}
data = {'data': json.dumps(params)}
headers = {'Authorization': '<YOUR_API_KEY>'}

r = requests.post(
    url,
    files=files,
    data=data,
    headers=headers
)

with open('file.jpeg', 'wb') as f:
    f.write(r.content)
const request = require('request');
const fs = require('fs');

let req = request.post({
    url: 'https://jpeg.to/v1/api',
    headers: {
        'Authorization': '<YOUR_API_KEY>'
    },
    formData: {
        file: fs.createReadStream('file.pdf'),
        data: JSON.stringify({'convert_to': 'jpeg'})
    }
});

req.on('response', function(response) {
    response.pipe(fs.createWriteStream('file.jpeg'));
});