Skip to content

icc_transform vs colourspace for handling of 16-bit images vs 8-bit images #3966

Answered by jcupitt
daniellovera asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @daniellovera,

image_vips = vips.Image.new_from_buffer(image_bytes, "", access='sequential')
untagged_profile_default = "srgb"
if image_vips.get_typeof('icc-profile-data') != 0:
    # get and log the profile info using Pillow ImageCms
    image_profile = ImageCms.getProfileInfo(io.BytesIO(image_vips.get('icc-profile-data')))
    logger.info(f'Image profile is {image_profile}')
elif image_vips.get_typeof('icc-profile-data') == 0 and image_vips.interpretation == 'cmyk':
        untagged_profile_default = "cmyk"
image_2_srgb = image_vips.icc_transform("srgb", embedded=True, input_profile=untagged_profile_default)
image_array = image_2_srgb.numpy()

I don't think you need to do this, do …

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@daniellovera
Comment options

@jcupitt
Comment options

@jcupitt
Comment options

@daniellovera
Comment options

Answer selected by daniellovera
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants