Cookie Consent by Free Privacy Policy Generator

SDK documentation

Convert HDR image into web-ready images with a single call using the jpghdr-sdk-php package. Take a look at the /examples directory for advanced usage and additional integration options.

Installation

> composer require hdrjpg/hdrjpg-sdk-php
Use a testing API key while working on your integration to avoid incurring any costs:
Convert a HEIC or EXR HDR image into different image sizes and qualities and store web-ready resulting files locally:
use TinCat\HdrjpgSdkPhp\Client;
$client = new Client('iS1nrfLP7KSCkeVlb1hKUL39eyUHsjE+KnLwmh6j'); // Replace with your API Key
$client->convert(
    'example.heic', // Complete path for your Source HDR image file
    [ // An array of variants
        [ // Each variant defines the settings for each resulting image
            'width' => 1200,
            'baseQuality' => 98,
            'format' => 'jpeg-xt'
        ],
        [
            'width' => 800,
            'baseQuality' => 98,
            'format' => 'jpeg-xt'
        ],
        [
            'width' => 300,
            'baseQuality' => 98,
            'gainmapQuality' => 95,
            'format' => 'jpeg-xt'
        ],
        [
            'width' => 1200,
            'baseQuality' => 98,
            'format' => 'jpeg-xl'
        ],
        [
            'width' => 1200,
            'baseQuality' => 98,
            'format' => 'mp4'
        ],
        [
            'height' => 300,
            'baseQuality' => 98,
            'fileName' => 'image-converted',
            'format' => 'avif'
        ]
    ],
    '/tmp' // Output directory to save resulting files to
);
                
The following files will be created in /tmp:
  • example_300xq98-95.jpg
  • example_800xq98-98.jpg
  • example_1200xq98-95.jpg
  • example_1200xq98.jxl
  • example_1200xq98.mp4
  • image-converted.avif