HDR Brackets
In this guide we will be walking you through how to enhance your first HDR image, you will:
Learn how to register the fact you want to upload 2 or more brackets for an HDR image with Autoenhance
Upload your image file for each bracket to Autoenhance using the provided endpoint received after registering your image
Tell Autoenhance you have finished uploading your brackets and you are ready for it to start merging them.
Checking the status of the order
Downloading the final enhanced HDR image
This guide assumes the following:
You already have an API key, if you don't have one please see our guide here.
That you have already uploaded a single bracket, if you haven't we reccomend you follow our guide here
1. Creating an Order
Before we can upload some brackets we need to create an order for them live so that Autoenhance understands that they are related to each other. To do this we issue a POST request to the /orders endpoint.
const createOrder = async (apiKey) => {
const createOrderResponse = await fetch(
"https://api.autoenhance.ai/v3/orders/",
{
method: "POST",
headers: {
"Content-Type": "application/json",
"x-api-key": apiKey,
}
}
);
return { order_id } = await createOrderResponse.json();
}import requests
import json
def create_order(api_key):
create_order_url = "https://api.autoenhance.ai/v3/orders/"
headers = {
"Content-Type": "application/json",
"x-api-key": api_key,
}
create_order_response = requests.post(create_order_url, headers=headers)
if create_order_response.status_code != 200:
create_order_response.raise_for_status()
return create_order_response.json['order_id']2. Uploading the brackets
Now we need to register and upload the file for each bracket, to do this we create a POST request to the dedicated /brackets endpoint and provide the order_id we got from the orders endpoint. This is so that Autoenhance knows that these brackets belong together and are eligible to be merged together.
2. Grouping and enhancing your brackets
Once you have uploaded all of your brackets, you are now ready to request Autoenhance start grouping them into images and then enhancing them.
There are three options depending on your use case.
By default when you call the /orders/<order_id>/process endpoint, Autoenhance will analyse the metadata and visual similarity of your brackets. They will be automatically grouped together and returned as a single HDR image.
In cases where you already know each time how many brackets you shot you can provide the /orders/<order_id>/process endpoint the number_of_brackets_per_image field with a number - in this case Autoenhance will sort your brackets by the time they were shot using their metadata and group your brackets based on this i.e if you set this to 3 then every 3 brackets will be grouped into one image
In cases where you have already grouped your brackets, you can send these groups to Autoenhance by passing an "images" array , each item should be an object containing a "bracket_ids" fields containing another array with the ID for each bracket you registered earlier.
When calling the /process endpoint you can send all of the image preferences listed here, these will be used when enhancing your images. If you do not provide these, we will apply default settings.
3. Checking the order status
Grouping brackets for each HDR image can take between 10 seconds to 5 minutes to complete depending on the number of brackets that need grouping.
We can check when this has finished by calling the GET /order/<order_id> endpoint and reading the is_merging and is_processing fields. Whilst the AI is still grouping the orders is_merging will be true, however if you want to display the progress of this grouping to customers then the images field will gradually be populated with images.
As each image is grouped the AI will automatically start enhancing them, you can check the status of each image individually using their status fields. Once all images have been enhanced the is_processing field for the order will change to false which can be used to stop showing any processing indicators to your end user.
You should always check your order status before downloading your images. In this case, we need to check whether the order has falsy values for is_merging and is_processing or not. You can start downloading all of your images once both of them are false.
4. Downloading image
Once our order has finished grouping and enhancing we can download the images as usual.
By default this endpoint will return a preview image you can show to your customers before they purchase the image. When they decide they want to download the image simply send ?preview=false to purchase and download the full sized image from Autoenhance.
During development you can test this workflow without using your credits by utilizing development mode, simply set the x-dev-mode to true. You can learn more about the development mode here.
Last updated