# 返回原图 (/products/dora/image-processing-api/the-advanced-treatment-of-images-imagemogr2/13-ignore-error)



最近更新时间: 2025-02-19 14:07:26

# **简介** [#简介]

**imageMogr2** 提供一系列高级图片处理功能，本文介绍 **返回原图**，即 `对特定场景下` 的图片处理失败进行兜底，保证图片处理返回原图或原输入，而不是直接报错；一定程度上提高图片处理的可用性，提升用户体验。

可与 **imageMogr2** 的其他参数一起使用，设置该参数生效后返回原图，不会计费。

# **参数说明** [#参数说明]

**注意**：接口规格不含任何空格与换行符。

```
imageMogr2/ignore-error/<ignoreError>
```

## 参数说明 [#参数说明-1]

| 参数名称                               | 必填 | 说明                                                                                                                                                                                                                     |
| ---------------------------------- | -- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ignore-error/&lt;ignoreError&gt;` | 否  | **设置该参数，取值为1，针对以下场景的处理失败，会直接返回源文件或原输入，而不是报错**：<br />**1**. 图片兼容性问题，导致的处理失败<br />**2**.  触发同步/持久化处理的输入输出限制，如格式、文件大小、宽、高、总像素、帧数，导致的处理失败<br />**注意**：<br />● 不设置此参数，处理失败时返回错误信息；<br />● 当输入文件超过1GB，设置此参数不生效，处理失败时返回错误信息 。 |

# **示例** [#示例]

* 简单示例，触发同步输出限制，返回原图：输出avif，图片 `w`和`h` 不能超过9999像素，总像素不能超过768w像素。

  ```
  https://dn-dora-document.qbox.me/pexels-clement.jpg?imageMogr2/format/avif/ignore-error/1
  ```

  ![img](/docs-assets/products/dora/%284-api-docs%29/image-processing-api/the-advanced-treatment-of-images-imagemogr2/13-ignore-error/pexels-clement-79e89c0a44bf.webp)

* 复杂示例，使用 [管道](/products/dora/processing-mechanism/3-the-pipe) ，返回原输入：如果第一步 `加水印` ，处理成功；第二步 `转avif格式`，触发avif格式的同步输出限制，设置 ignore-error 生效后，会返回原输入（即第一步处理结果）。

  ```
  https://dn-dora-document.qbox.me/pexels-clement.jpg?watermark/2/text/5LiD54mb5LqR5a2Y5YKo/fontsize/10000/fill/I0ZGRkZGRg==/ignore-error/1|imageMogr2/format/avif/ignore-error/1
  ```

  ![img](/docs-assets/products/dora/%284-api-docs%29/image-processing-api/the-advanced-treatment-of-images-imagemogr2/13-ignore-error/pexels-clement-f074b27b4a93.webp)

# **计费说明** [#计费说明]

设置 ignore-error/1 生效后，不会计费。

* 计费示例：[管道](/products/dora/processing-mechanism/3-the-pipe) 存在时，比如 `A/ignore-error/1\|B/ignore-error/1`，A处理成功，B处理失败（设置，则A计费，B不计费，结果返回A处理结果。
