Image Quality API
Introduction
The Image Quality API allows users to upload an image and determine its quality for further processing. The API evaluates the image based on various quality parameters and provides a score indicating its usability. This documentation provides details on how to call the API, input guidelines, sample responses, and other relevant information.
Types of Quality Check
The product has four types of quality checks namely:
- Sharpness check - This feature tells if the image is sharp i.e. no blur in image is present. 0 is blur, 1 is sharp.
- Brightness check - This feature tells if the image is bright enough for OCR. 0 is dark, 1 is good bright.
- Compression quality check - This feature tells if the image is pixelated. 0 is compressed, 1 is good.
- Text readable - This tells whether the text present on the image is readable or not. 0 is bad, 1 is good.
How to call the API
Before making API requests, you need to perform a login authentication and obtain an access token. The access token should be included in the authorization header of subsequent API requests. The API endpoints and environments for different operations are provided below.
API Input Guidelines
The Image Quality API is used to detect the quality of an image and determine its usability for further processing. You can upload an image or provide a direct URL to the image.
Endpoints | Environment |
|---|---|
https://preproduction.signzy.tech/api/v2/patrons/{patron-id}/imagequality | Preproduction |
https://signzy.tech/api/v2/patrons/{patron-id}/imagequality | Production |
Request Body Parameters
PARAMETER NAME | Required/Optional | DESCRIPTION |
|---|---|---|
files | Required | (array): URLs of the image files to be evaluated (array of length one). |
qualityParameter | Optional | (string): Specifies the type of quality check to perform. Valid options are all, blur, brightness, compressionQuality, and textQuality. Default is all. |
acceptanceThreshold | | (string): Acceptance threshold value between 0 and 1. Default is not set. |
{
"essentials": {
"files": ["...url..to..file.. (array of length one)"],
"qualityParameter":"all | blur | brightness | compressionQuality | textQuality"
"acceptanceThreshold":"...0-1..."
}
}Request Header Parameters
Header Name | Required/Optional | DESCRIPTION |
|---|---|---|
Authorization | Required | access token returned as id field of login request |
Content-Type | Required | application/json |
Sample Codes
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://signzy.tech/api/v2/patrons/...patronID.../imagequality"
method := "POST"
payload := strings.NewReader(`{
"essentials": {
"files": ["...url of the file..."],
"qualityParameter": "all | blur | brightness | compressionQuality | textQuality"
}
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Accept-Language", "en-US,en;q=0.8")
req.Header.Add("Accept", "*/*")
req.Header.Add("Authorization", "<Access-Token>")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}Sample Response
{
"essentials": {
"files": ["{image-URL}"]
},
"id": "{id}",
"patronId": "{patron-ID}",
"result": {
"qualityScores": {
"sharpness": {
"score": "0 to 1",
"valid": "yes|no"
},
"brightness": {
"score": "0 to 1",
"valid": "yes|no"
},
"compressionQuality": {
"score": "0 to 1",
"valid": "yes|no"
},
"textQuality": {
"score": "0 to 1",
"valid": "yes|no"
}
},
"extractionQuality": "veryLow|low|medium|high",
"summary": "accept|reject",
"score": "0 to 1",
"msg": "done"
}
}Response Parameter
Parameter Name | Description |
|---|---|
qualityScores | (object): Quality scores for different parameters. |
sharpness | (object): Sharpness score and validity. Sharpness score ranging from 0 to 1.Validity of sharpness ("yes" or "no"). |
brightness | Brightness score and validity.Brightness score ranging from 0 to 1.Validity of brightness ("yes" or "no"). |
compressionQuality | (object): Compression quality score and validity. Compression quality score and validity.Validity of compression quality ("yes" or "no"). |
textQuality | (object): Text quality score and validity.Text quality score ranging from 0 to 1.Validity of text quality ("yes" or "no"). |
summary | (string): Summary of the image quality ("accept" or "reject"). |
score | (string): Overall quality score ranging from 0 to 1. |
msg | (string): Status message indicating the completion of the API call. |
Note: Please note that the maximum image size supported is 2MB.
Sample Error
{
"message": "No API key found in request"
}Status Codes
Status Code | Description |
|---|---|
200 | OK |
400 | Bad Request |
401 | Authorization token is invalid |
422 | Unprocessable Entity |
Getting help
Please feel free to contact us if you have any questions, require clarification, or have ideas for how to make the documents or any of our services better.
You can reach out to us at [email protected].