# How to check if a surface has an alpha-channel?

**URL:** <https://discourse.libsdl.org/t/how-to-check-if-a-surface-has-an-alpha-channel/6742>\
**Category:** SDL Development\
**Created:** [May 28, 2002, 2:52pm UTC](https://discourse.libsdl.org/t/how-to-check-if-a-surface-has-an-alpha-channel/6742 "2002-05-28T14:52:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Juhana\_Lehtiniemi](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/j/ecae2f/32.png) [@Juhana\_Lehtiniemi](https://discourse.libsdl.org/u/Juhana_Lehtiniemi)\
**Post date:** [May 28, 2002, 2:52pm UTC](https://discourse.libsdl.org/t/how-to-check-if-a-surface-has-an-alpha-channel/6742/1 "2002-05-28T14:52:01Z")

</div>

Is there a property or some function to check if an SDL\_Surface has an  
alpha-channel? I don’t mean this alpha-value that is for every pixel, but  
the one that was loaded from the image.

---

<div class="post-metadata">

**Author:** ![Jonathan\_Atkins](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/j/8baadc/32.png) [@Jonathan\_Atkins](https://discourse.libsdl.org/u/Jonathan_Atkins)\
**Post date:** [May 28, 2002, 3:54pm UTC](https://discourse.libsdl.org/t/how-to-check-if-a-surface-has-an-alpha-channel/6742/2 "2002-05-28T15:54:01Z")

</div>

Juhana Lehtiniemi wrote:

> Is there a property or some function to check if an SDL\_Surface has an  
> alpha-channel? I don’t mean this alpha-value that is for every pixel, but  
> the one that was loaded from the image.

perhaps just check and see if surface-\>format-\>Amask is not zero…–  
-==-  
Jon Atkins  
[http://jcatki.2y.net/](http://jcatki.2y.net/)
