# SDL\_image: Only set the maxCLL/macFALL properties if they're in the image metadata

**URL:** <https://discourse.libsdl.org/t/sdl-image-only-set-the-maxcll-macfall-properties-if-theyre-in-the-image-metadata/49374>\
**Category:** SDL Commits\
**Created:** [February 22, 2024, 3:28am UTC](https://discourse.libsdl.org/t/sdl-image-only-set-the-maxcll-macfall-properties-if-theyre-in-the-image-metadata/49374 "2024-02-22T03:28:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SDLPushPostBot](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/sdlpushpostbot/32/4370_2.png) [@SDLPushPostBot](https://discourse.libsdl.org/u/SDLPushPostBot)\
**Post date:** [February 22, 2024, 3:28am UTC](https://discourse.libsdl.org/t/sdl-image-only-set-the-maxcll-macfall-properties-if-theyre-in-the-image-metadata/49374/1 "2024-02-22T03:28:20Z")

</div>

> <https://github.com/libsdl-org/SDL_image/commit/8cf24ba99ed76697b2ddae3dc5b2647948b96ac1>

```diff
From 8cf24ba99ed76697b2ddae3dc5b2647948b96ac1 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Tue, 20 Feb 2024 10:06:53 -0800
Subject: [PATCH] Only set the maxCLL/macFALL properties if they're in the
 image metadata

---
 src/IMG_avif.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/IMG_avif.c b/src/IMG_avif.c
index 60fd2a33..331842b4 100644
--- a/src/IMG_avif.c
+++ b/src/IMG_avif.c
@@ -441,8 +441,10 @@ SDL_Surface *IMG_LoadAVIF_RW(SDL_RWops *src)
                                                               SDL_MATRIX_COEFFICIENTS_IDENTITY,
                                                               SDL_CHROMA_LOCATION_NONE);
             SDL_SetNumberProperty(props, SDL_PROP_SURFACE_COLORSPACE_NUMBER, colorspace);
- SDL_SetNumberProperty(props, SDL_PROP_SURFACE_MAXCLL_NUMBER, image->clli.maxCLL);
- SDL_SetNumberProperty(props, SDL_PROP_SURFACE_MAXFALL_NUMBER, image->clli.maxPALL);
+ if (image->clli.maxCLL > 0 || image->clli.maxPALL > 0) {
+ SDL_SetNumberProperty(props, SDL_PROP_SURFACE_MAXCLL_NUMBER, image->clli.maxCLL);
+ SDL_SetNumberProperty(props, SDL_PROP_SURFACE_MAXFALL_NUMBER, image->clli.maxPALL);
+ }
 
             // A good approximation to compress HDR content to SDR
             // More complex tone mapping algorithms can be added and set by the caller in the future.

```
