Convert an image RGB->Lab with python

前端 未结 4 2077
醉梦人生
醉梦人生 2020-12-07 12:44

What is the preferred way of doing the conversion using PIL/Numpy/SciPy today?

4条回答
  •  温柔的废话
    2020-12-07 13:24

    Edit: Sample pyCMS code:

    from PIL import Image
    import pyCMS
    im = Image.open(...)
    im2 = pyCMS.profileToProfile(im, pyCMS.createProfile("sRGB"), pyCMS.createProfile("LAB"))
    

    Edit: Pillow, the PIL fork, seems to have pyCMS built in.

    You might use pyCMS (http://www.cazabon.com/pyCMS/) which works with PIL images.

    If speed is not a factor, use python-colormath (http://code.google.com/p/python-colormath/).

提交回复
热议问题