What is Image Quality Assessment?
It is easy to take photos, but it is difficult to take good ones. It requires good composition and good lighting. The right lens and top quality hardware can make a big difference. Most importantly, a high quality photo requires good taste and judgment. You need an expert eye. But is there a mathematical measure of quality that constitutes this human judgment?
Some quality metrics can be easily captured with an algorithm. For example, we can look at information captured by pixels and mark an image as noise or blurry. On the other hand, some quality metrics are nearly impossible for an algorithm to catch. For example, an algorithm finds it difficult to judge the quality of a photo that requires cultural context.
There is a scientific method called BRISQUE (Blind/Referenceless Image Spatial Quality Evaluator ) which is a no-reference image quality score well-accepted in the market. This API is a sclable and performant implementation of this method.
You can use this service for:
- Determining the best image of the product to display on the front page
- Sort the products/listings based on the image quality score on your e-commerce site
- Show only the high-quality images for adverts
- Only permitting high-quality images for your listing/product
Evaluating an image on a URL
First, start by subscribing to the service (free tier available), get your API key and you are ready. Next, you can test using the following cURL command. This code will fetch the image located at https://.../sample.jpg
curl --request GET \
--url 'https://api.apilayer.com/image_quality/url?url=https%3A%2F%2Fassets.apilayer.com%2Fapis%2Fcodes%2Fimage_quality%2Fsample.jpg' \
--header 'apikey: YOUR API KEY HERE'
The results will be as follows
Evaluating an image from local file
Use the following code to upload an image from your computer to the service and get the quality score in JSON format immediately back.
curl --location --request POST 'https://api.apilayer.com/image_quality/upload' \
--header 'Content-Type: application/octet-stream' \
--header 'apikey: YOUR API KEY HERE' \