after lots of cherry-pick I found that for some strange reason,
pic.c is not updated and I cannot find out which commit I missed.
So I simply copied the latest pic.c from the master branch here.
This is to make adding support for new formats easier.
See the file pic_jpeg.h for the description of the interface that each
image format must support.
Conflicts:
Makefile
If the number of colour components is neither 1 nor 3 we should remember
to free the buffer holding the raw decoded image before returning the
error to Lua.