Open wcout opened 5 years ago
I can modify the loader so it won`t panic on empty palettes, just boldly returning 0 in cpal
.
The additional field seems superfluous, since the right field to hold the number of colors requested by the GIF is definitely clrs
.
That would also be an option. And you would set if from color resolution
?
The naming of the cpal struct would be required also.
This is just a request for a feature you may want to support:
The standard says, that both global and local color tables are no required blocks. In that case the application can use a default colormap.
Currently
gif_load.h
does not parse such images.I have made some changes in my copy to support it:
(1) Continue parsing when
clrs
is 0. (2) Give access to the palette definition in theGIF_WHDR
structure. (3) Return the value of the GIF header fieldcolor resultion
. As I read it, it can be used in such a case to determine how many colors the palette has in order to supply a suitable replacement.(1) and (2) would be nice to have, (3) could in principle also be done in the application, because the value is at a fixed position in the file.
These are my changes:
In my program I'm doing something like that, when there are no colors: