> ## Documentation Index
> Fetch the complete documentation index at: https://cloudinary.com/documentation/llms.txt
> Use this file to discover all available pages before exploring further.

# Accessibility analysis


Analyzing your images for accessibility can help you to choose the best images for people with color blindness.

> **INFO**:
>
> **Accessibility analysis** is currently in Beta. Some implementation details may change before the official release. If you have a paid account, you can [request to take part](https://support.cloudinary.com/hc/en-us/requests/new) in the Beta trial.  We invite you to share any feedback via our [support team](https://support.cloudinary.com/hc/en-us/requests/new).

You can request accessibility analysis while [uploading](image_upload_api_reference#upload) an image, or by using the [explicit](image_upload_api_reference#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:

``` multi
|ruby 
Cloudinary::Uploader.upload("user_photo.jpg", 
  accessibility_analysis: true)

|php_2
$cloudinary->uploadApi()->upload("user_photo.jpg",
  [ "accessibility_analysis" => true ]);

|nodejs
cloudinary.v2.uploader
.upload("user_photo.jpg",
  { accessibility_analysis: true })
.then(result=>console.log(result)); 

|python
cloudinary.uploader.upload("user_photo.jpg",
  accessibility_analysis = 1)

|java
cloudinary.uploader().upload("user_photo.jpg", 
  Cloudinary.asMap("accessibility_analysis", true));

|csharp
var uploadParams = new ImageUploadParams(){
  File = new FileDescription(@"user_photo.jpg"),
  AccessibilityAnalysis = true};
var uploadResult = cloudinary.Upload(uploadParams);

|go
resp, err := cld.Upload.Upload(ctx, "user_photo.jpg", uploader.UploadParams{
	AccessibilityAnalysis: api.Bool(true)})

|cli
cld uploader upload user_photo.jpg accessibility_analysis=true

|curl
curl https://api.cloudinary.com/v1_1/demo/image/upload -X POST --data 'file=user_photo.jpg&accessibility_analysis=true&timestamp=173719931&api_key=436464676&signature=a788d68f86a6f868af'
```

## Accessibility analysis on already uploaded images

There are two ways to request quality analysis on already uploaded images:

* Use the [Explicit](image_upload_api_reference#explicit_method) 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](admin_api#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](image_upload_api_reference#explicit_method) method of the Upload API to request quality analysis on the image with a public ID of "user1":

``` multi
|ruby 
Cloudinary::Uploader.explicit("user1", 
  type: "upload",
  accessibility_analysis: true)

|php_2
$cloudinary->uploadApi()->explicit("user1",[ 
    "type" => "upload",
    "accessibility_analysis" => true ]);

|nodejs
cloudinary.v2.uploader.explicit("user1",
  { type: "upload",
    accessibility_analysis: true })
.then(result=>console.log(result)); 

|python
cloudinary.uploader.explicit("user1",
  type = "upload",
  accessibility_analysis = 1)

|java
cloudinary.uploader().explicit("user1", 
  Cloudinary.asMap(
    "type", "upload",
    "accessibility_analysis", true));

|csharp
var explicitParams = new ExplicitParams("user1"){
  Type = "upload",
  AccessibilityAnalysis = true};
var uploadResult = cloudinary.Explicit(explicitParams); 

|go
resp, err := cld.Upload.Explicit(ctx, uploader.ExplicitParams{
    PublicID: "user1",
    Type: "upload",
	AccessibilityAnalysis: api.Bool(true)})

|cli
cld uploader explicit user1 type="upload" accessibility_analysis=true

|curl
curl https://api.cloudinary.com/v1_1/demo/image/explicit -X POST --data 'type=upload&public_id=user1&accessibility_analysis=true&timestamp=173719931&api_key=436464676&signature=a788d68f86a6f868af'
```

### Update resources example

The following example uses the [Update resources](admin_api#update_resources) method of the Admin API to request quality analysis on an uploaded image with a public ID of "table":

```multi
|curl
curl \
 -d "type=upload&accessibility_analysis=true" \
 -X POST \
 https://<API_KEY>:<API_SECRET>@api.cloudinary.com/v1_1/<cloud_name>/resources/image/upload/table
        
|ruby
result = Cloudinary::Api
.update("table",
  type: "upload",
  accessibility_analysis: true)

|php_2
$result = $api
->update("table", [
    "type" => "upload",
    "accessibility_analysis" => true]);

|python
result = cloudinary.api\
.update("table",
  type = "upload",
  accessibility_analysis = True)

|nodejs
cloudinary.v2.api
.update("table", 
  { type: "upload",
    accessibility_analysis: true})
.then(result=>console.log(result)); 

|java
result = cloudinary.api()
.update("table",
  ObjectUtils.asMap(
    "type", "upload",
    "accessibility_analysis", true));

|csharp
var updateParams = new UpdateParams("table"){
  Type = "upload",
  AccessibilityAnalysis = true};
var updateResult = cloudinary.UpdateResource(updateParams); 

|go
	resp, err := cld.Admin.UpdateAsset(ctx, admin.UpdateAssetParams{
	PublicID:         "table",
	Type:           "upload",
	AccessibilityAnalysis:  api.Bool(true)})

|cli
cld admin update table type="upload" accessibility_analysis=true
```

## Sample response

```json
  "accessibility_analysis": {
    "colorblind_accessibility_analysis": {
      "distinct_edges": 0.93,
      "distinct_colors": 0.33,
      "most_indistinct_pair": [
        "#BCB0AA",
        "#B2BEC9"
      ]
    },
    "colorblind_accessibility_score": 0.63
  },
```

* `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_edges": 0

Deuteranopia simulation

* `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:

"distinct_colors": 0.33

Deuteranopia simulation

* `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](search_method) when `accessibility_analysis` is set to `true`, in the [upload](image_upload_api_reference#upload) request or an [upload preset](upload_presets). Note that this score is not indexed for search when returned as part of an [explicit](image_upload_api_reference#explicit_method) request.

## Video tutorial: image accessibility with JavaScript

Watch this video tutorial to understand how Cloudinary can help you with color accessibility. 

  This video is brought to you by Cloudinary's video player - embed your own!Use the controls to set the playback speed, navigate to chapters of interest and select subtitles in your preferred language.

### Tutorial contents This tutorial presents the following topics. Click a timestamp to jump to that part of the video.
### Introduction
{table:class=tutorial-bullets}|  | 
| --- | --- |
|{videotime:id=media :min=0 :sec=00 :player=cld} | Cloudinary can help you to see your images through the eyes of a color blind person, both subjectively and objectively, and provides transformations to make them more accessible.
|

### Why you should care about color accessibility
{table:class=tutorial-bullets}|  | 
| --- | --- |
|{videotime:id=media :min=0 :sec=19 :player=cld} | One in twelve men, and one in two hundred women suffer from Color Vision Deficiency. That's a significant proportion of the population who may miss vital information or are unable to engage fully with your site. Cloudinary allows you to experience all the different types of color blindness, by applying simple transformations.
|

### How to simulate color blindness
{table:class=tutorial-bullets}|  | 
| --- | --- |
|{videotime:id=media :min=0 :sec=47 :player=cld} | In a JavaScript environment, [install and configure the Cloudinary JavaScript SDK](javascript_quick_start) for your product environment, import the `simulateColorBlind` effect, and apply the effect your image.  Here, `publicId` and `colorType` are both strings defined elsewhere in the [app](https://github.com/cloudinary-devs/color-accessibility/blob/main/src/index.js) (see the full list of conditions in the [Transformation URL API Reference](transformation_reference#e_simulate_colorblind)):

```js
import { simulateColorBlind } from "@cloudinary/url-gen/actions/effect";

const myImage = cld.image(publicId);

myImage.effect(simulateColorBlind().condition(colorType));
```

### How to assist with color blindness
{table:class=tutorial-bullets}|  | 
| --- | --- |
|{videotime:id=media :min=1 :sec=16 :player=cld} |  You can apply stripes or an X-ray effect to images to help color blind people to distinguish one color from another. Import `assistColorBlind` and apply either the `xray()` or `stripesStrength()` version of the effect to your image.  For stripes, specify the strength of the stripes from 1 to 100:
|

```js
import { assistColorBlind } from "@cloudinary/url-gen/actions/effect";

myImage.effect(assistColorBlind().stripesStrength(20));
```

### Analyze your images objectively
{table:class=tutorial-bullets}|  | 
| --- | --- |
|{videotime:id=media :min=1 :sec=59 :player=cld} | The [Accessibility analysis](accessibility_analysis) feature lets you analyze your images objectively, to determine which of your images may cause problems for color blind people. Set the `accessibility_analysis` option to `true` when uploading images to return a color blind accessibility score, together with an analysis of the issues and the colors that may be the most problematic. See an example in this [GitHub repo](https://github.com/cloudinary-devs/color-accessibility-upload).
|

