---
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.

### Method signature

```typescript
petsPictureQualityDetectForImage(params: Object)
```

### Description

Pet image quality detection

### Parameters

| Property | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `inputImagePath` | `string` | Yes | - | Image input path |
| `labelAllow` | `1 \| 2` | No | `1` | Recognition type enum |
| `objectAreaPercent` | `number` | Yes | - | Ratio of the detected object size to the entire image; default 30, meaning: filter out if less than 30% |
| `objectFaceRotationAngle` | `number` | Yes | - | Face rotation angle of the detected object; default 45, meaning: filter out if over 45% |
| `objectFaceSideAngle` | `number` | Yes | - | Face profile angle of the detected object; default 40, meaning: filter out if over 40% |
| `maximumPictureBrightness` | `number` | Yes | - | Maximum brightness |
| `minimumPictureBrightness` | `number` | Yes | - | 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 | Description |
| --- | --- | --- |
| `imagePath` | `string` | Image URL |
| `lowQuality` | `boolean` | Whether the image is low quality |
| `lowQualityReason` | `number` | 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`

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


### Examples

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

ai.petsPictureQualityDetectForImage({
  inputImagePath: "xx",
  labelAllow: 1,
  objectAreaPercent: 1,
  objectFaceRotationAngle: 1,
  objectFaceSideAngle: 1,
  maximumPictureBrightness: 1,
  minimumPictureBrightness: 1,
  success: data => {
    console.log(data);
  },
  fail: error => {
    console.error(error);
  },
});
```
