How to save images in sRGB color profile

796 views Asked by At

Currently, I am using the line below to save images:

img.save(file + ".jpg", "JPEG")

but the images are saved in some other color profile, and I need to save the images in sRGB color profile.

1

There are 1 answers

0
Mark On BEST ANSWER

Is the image data sRGB to begin with? If so you should be able to use:

im.save(filename, 'jpeg', icc_profile=im.info.get('icc_profile'))

to preserve the profile. If it's not sRGB then you'll need to figure out how to interpret the RGB values. Normally this is done by knowing the color space of the RGB you're starting with and converting.