---
title: hi_mpi_png_get_image_info
description: "根据输入码流，获取png源图片的宽、高、源格式及源格式解码时输出图片的宽stride、高stride、以及所需的内存大小等信息。"
url: https://www.hiascend.com/document/detail/zh/Atlas200IDKA2DeveloperKit/latest/Application%20Development%20Guide/aadgc/aclcppdevg_03_1089.html
sourcePath: /source/zh/Atlas200IDKA2DeveloperKit/23.0.RC2/Application Development Guide/aadgc/aclcppdevg_03_1089.html
indexId: 98736698b3d2a0a18309aae634cbb3ed028abe6ecaea12d8f7e157c6b18502e4105
---
# hi_mpi_png_get_image_info

#### 函数功能

根据输入码流，获取png源图片的宽、高、源格式及源格式解码时输出图片的宽stride、高stride、以及所需的内存大小等信息。


#### 约束说明

提供给用户来计算解码后输出图片占用的内存大小。当前仅支持解析png图片。通过本接口获取的widthStride向上128对齐、heightStride向上16对齐。


#### 函数原型

hi_s32 hi_mpi_png_get_image_info(const hi_img_stream *png_stream, hi_img_info *img_info)


#### 参数说明

| 参数名 | 输入/输出 | 说明 |
| --- | --- | --- |
| png\_stream | 输入 | 输入码流信息的指针。 |
| img\_info | 输出 | 图片信息的指针。 |


#### 返回值说明

- 0：成功
- 非0：失败，参见  PNGD图像解码返回码
