Last updated: Dec-11-2024
Analyzing your images for accessibility can help you to choose the best images for people with color blindness.
You can request accessibility analysis while uploading an image, or by using the explicit method on an already uploaded image.
Accessibility analysis while uploading
You can request accessibility analysis while uploading by specifying the accessibility_analysis
parameter in the upload method.
For example, uploading the "user_photo.jpg" image and requesting accessibility analysis:
Accessibility analysis on already uploaded images
There are two ways to request quality analysis on already uploaded images:
- Use the Explicit method of the Upload API to request quality analysis on a single asset. This method is not rate-limited and requires a signature to be generated on the server side.
- Use the Update resources method of the Admin API. This method is rate-limited and requires your API key and secret, so is not suitable for use in client-side code.
Explicit example
The following example uses the Explicit method of the Upload API to request quality analysis on the image with a public ID of "user1":
Update resources example
The following example uses the Update resources method of the Admin API to request quality analysis on an uploaded image with a public ID of "table":
Sample response
-
distinct_edges
is a score between 0 and 1. A low score indicates that there are parts of the image that may be camouflaged to people with color blind conditions. For example, in this image, the grasshopper appears camouflaged to people with the color blind condition, deuteranopia:
-
distinct_colors
is a score between 0 and 1. A low score indicates that there are colors that color blind people would find hard to differentiate between. In this example, the red and green slices of the pie chart appear the same to someone with deuteranopia:
-
most_indistinct_pair
shows the two colors (in RGB hex format) that color blind people would find the hardest to tell apart. -
colorblind_accessibility_score
is an overall score, taking each of the components into account.
The accessibility_analysis.colorblind_accessibility_score
field can be used in the search method when accessibility_analysis
is set to true
, in the upload request or an upload preset. Note that this score is not indexed for search when returned as part of an explicit request.
Video tutorial: image accessibility with JavaScript
Watch this video tutorial to understand how Cloudinary can help you with color accessibility.