Fix jpeg CMYK and grayscale transparency, add jpeg bicubic

Final version pending any bugs
Jpeg CMYK images are now scaled properly, same for transparent grayscale PNG (colour spaces and num_components treated more robustly)
Sanity checks more robust, all dimensions tested *after* applying scaling rules in case scale towards longer side is set
Cutover point from interpolation to area sampling tweaked
Some portable data types fixed
Some error handling nits fixed
Bicubic algorithm copied into jpeg_resize, still ifdef'd out but maybe useful one day