Python 3.x PyCMS:ICC Profil无法转换

Python 3.x PyCMS:ICC Profil无法转换,python-3.x,profile,icc,color-management,Python 3.x,Profile,Icc,Color Management,现在我有一个关于智能手机摄像头颜色管理的项目,我有一个问题,我不能在pycms中转换我自己制作的icc配置文件。它总是引发错误“PIL.ImageCms.PyCMSError:无法生成转换”。现在,我很困惑,当我使用标准icc配置文件时,转换总是成功的 因此,我认为有一个问题,我自己的ICC配置文件或一些错误的代码。因此,我用3种方法制作了智能手机摄像头的ICC配置文件: 第一种方法:使用软件“颜色检测器摄像机校准” 首先,我从不同的智能手机上采集了所有图片。然后,我将“jpeg”图片转换为“T

现在我有一个关于智能手机摄像头颜色管理的项目,我有一个问题,我不能在pycms中转换我自己制作的icc配置文件。它总是引发错误“PIL.ImageCms.PyCMSError:无法生成转换”。现在,我很困惑,当我使用标准icc配置文件时,转换总是成功的

因此,我认为有一个问题,我自己的ICC配置文件或一些错误的代码。因此,我用3种方法制作了智能手机摄像头的ICC配置文件:

第一种方法:使用软件“颜色检测器摄像机校准” 首先,我从不同的智能手机上采集了所有图片。然后,我将“jpeg”图片转换为“Tiff”,并将其放入软件中。最后,我得到了我的icc档案

使用软件“I1 Profiler”的第二种方法和使用“Baicolor input 6”的第三种方法也与第一种方法类似

但我的代码中无法转换所有Icc配置文件。现在我不知道我的代码或ICC配置文件中的问题在哪里。你能告诉我哪里有问题吗?在我的ICC档案上还是在我的代码上?以下是我在Python3.7中的代码,在超链接中你也可以找到我的icc

import os
from PIL.ImageCms import *


# initialization the current working directory into a dictionary 
def init():
    current_dir = os.path.abspath(os.path.dirname(__file__))
    return {
        'honor6x': os.path.join(current_dir, 'icc_profile', 'honor6x.icc'),
        'honor7i': os.path.join(current_dir, 'icc_profile', 'honor7i.icc'),
        'huawei-p30pro': os.path.join(current_dir, 'icc_profile', 'huawei-p30pro.icc'),
        'iphone6s': os.path.join(current_dir, 'icc_profile', 'iphone6s.icc'),
        'iphone8': os.path.join(current_dir, 'icc_profile', 'iphone8.icc'),
        'iphonex': os.path.join(current_dir, 'icc_profile', 'iphonex.icc'),
        'samsung-s8': os.path.join(current_dir, 'icc_profile', 'samsung-s8.icc'),
        'sony-G8341': os.path.join(current_dir, 'icc_profile', 'sony-G8341.icc')
    }


# the main function to carry out the icc-profile retrieval with the input of the smartphone type,
# and correction the input photos through the icc-profile
def main():
    #my_phone = input('give me a type of smartphone:')
    #icc = get_icc(my_phone)
    #if not icc:
     #   return
    #print(icc)
    inputProfile = ImageCmsProfile(os.path.join('icc_profile', 'sRGB_IEC61966-2-1_no_black_scaling(v4).icc'))
    outputProfile = ImageCmsProfile(os.path.join('icc_profile', 'sRGB2014(v2.0.0).icc'))
    print(outputProfile)
    # input the new photo and transform it to the corrected photo through the icc-Profile
    my_photo = input('give me a photo of the smartphone:')
    im = Image.open(my_photo)


    im_converted = profileToProfile(im, inputProfile, outputProfile, renderingIntent=1)
    # after the transformation of the input photo, save the corrected photos as a target photo
    im_converted.save (f"{my_photo}_corrected.jpeg")

# search the input type smartphone with the relevant icc profile, if the input type in the dict and get its icc
# if not, print it
def get_icc(my_phone):
    if my_phone not in icc_dict:
        print(f'{my_phone} is not validated!')
    return icc_dict.get(my_phone)



if __name__ == '__main__':
    icc_dict = init()

    main()