Fix IOError: cannot write mode CMYK as PNG

This happens if a JPEG image with mode CMYK uses `filters:format(png)`, when trying to save the image.