diff --git a/src/m_anigif.c b/src/m_anigif.c
index f30effb9bb715f0037be5a4684bf25aa700a696e..85118790bf6f72b28a81069d3a59117a5bb57cbf 100644
--- a/src/m_anigif.c
+++ b/src/m_anigif.c
@@ -507,7 +507,7 @@ static void GIF_rgbconvert(UINT8 *linear, UINT8 *scr)
 	size_t src = 0, dest = 0;
 	size_t size = (vid.width * vid.height * 3);
 
-	InitColorLUT(&gif_colorlookup, gif_framepalette, true);
+	InitColorLUT(&gif_colorlookup, (gif_localcolortable) ? gif_framepalette : gif_headerpalette, true);
 
 	while (src < size)
 	{