Separate sixel_encode_impl() into sixel_encode_header(), sixel_encode_body() and
sixel_encode_footer(). Cherry-picked from 339d958.

Conflicts:
	src/tosixel.c