diff --git a/Source/stb_image.h b/Source/stb_image.h index be014b2e94fe178d89d10f505d80e7fda27dac84..05aa3a71d7d54dbddf691421590fb2a001a3b7ff 100644 --- a/Source/stb_image.h +++ b/Source/stb_image.h @@ -1447,7 +1447,8 @@ STBIDEF stbi_uc *stbi_load_gif_from_memory(stbi_uc const *buffer, int len, int * result = (unsigned char*) stbi__load_gif_main(&s, delays, x, y, z, comp, req_comp); if (stbi__vertically_flip_on_load && result) { - stbi__vertical_flip_slices( result, *x, *y, *z, *comp ); + int channels = req_comp ? req_comp : *comp; + stbi__vertical_flip_slices( result, *x, *y, *z, channels ); } return result;