---
name: "petsPictureQualityDetectForImage"
mode: "kit"
versionRequirements:
  - { name: "AIKit", version: "1.3.0" }
  - { name: "@ray-js/ray", version: "1.7.20" }
platform:
  - "iOS"
  - "Android"
async: true
title: "petsPictureQualityDetectForImage"
---

## petsPictureQualityDetectForImage

> [VERSION] AIKit >= 1.3.0 | @ray-js/ray >= 1.7.20

> [PLATFORM] iOS, Android

> ⚡ **Supports Promise** — Returns a Promise when success / fail / complete callbacks are omitted.

### Description

Pet image quality detection

### Parameters

| Property | Type | Required | Default | Since | Description |
| --- | --- | --- | --- | --- | --- |
| `inputImagePath` | `string` | Yes | - | `1.3.0` | Image input path |
| `labelAllow` | `1 \| 2` | No | `1` | `1.3.0` | Recognition type enum |
| `objectAreaPercent` | `number` | Yes | - | `1.3.0` | Ratio of the detected object size to the entire image; default 30, meaning: filter out if less than 30% |
| `objectFaceRotationAngle` | `number` | Yes | - | `1.3.0` | Face rotation angle of the detected object; default 45, meaning: filter out if over 45% |
| `objectFaceSideAngle` | `number` | Yes | - | `1.3.0` | Face profile angle of the detected object; default 40, meaning: filter out if over 40% |
| `maximumPictureBrightness` | `number` | Yes | - | `1.3.0` | Maximum brightness |
| `minimumPictureBrightness` | `number` | Yes | - | `1.3.0` | Minimum brightness |
| `complete` | `() => void` | No | - | - | Completion callback (executed on both success and failure) |
| `success` | `(params: Object) => void` ↓see below | No | - | - | Callback on successful API call |
| `fail` | `(params: Object) => void` ↓see below | No | - | - | Failure callback |

#### success callback parameters

| Property | Type | Since | Description |
| --- | --- | --- | --- |
| `imagePath` | `string` | `1.3.0` | Image URL |
| `lowQuality` | `boolean` | `1.3.0` | Whether the image is low quality |
| `lowQualityReason` | `number` | `1.3.0` | Reason for low quality |

#### fail callback parameters

| Property | Type | Description |
| --- | --- | --- |
| `errorMsg` | `string` | Error message |
| `errorCode` | `string \| number` | Error code |
| `innerError` | `Object` | Error extension |

##### fail(params).innerError properties

| Property | Type | Description |
| --- | --- | --- |
| `errorCode` | `string \| number` | Error extension code |
| `errorMsg` | `string` | Error extension message |


### Valid Values

##### `labelAllow` valid values

| Value | Description |
| --- | --- |
| `1` | Cat |
| `2` | Dog |


### Examples

#### Basic usage

```tsx
import { ai } from '@ray-js/ray'

const { petsPictureQualityDetectForImage } = ai;

petsPictureQualityDetectForImage({
  inputImagePath: 'example',
  objectAreaPercent: 0,
  objectFaceRotationAngle: 0,
  objectFaceSideAngle: 0,
  maximumPictureBrightness: 0,
  minimumPictureBrightness: 0,
  success: (result) => {
    console.log('petsPictureQualityDetectForImage success', result);
  },
  fail: (error) => {
    console.log('petsPictureQualityDetectForImage fail', error.errorMsg);
  },
});
```
