def modify_vips_image_before_output(image, convertParams, **kwargs):
    """
    Make sure the vips image is either 1 or 3 bands.

    :param image: a vips image.
    :param convertParams: the parameters that will be used for compression.
    :returns: a vips image.
    """
    return image[:3 if image.bands >= 3 else 1]