2012-10-16 00:26:38 +04:00
|
|
|
from PIL import Image
|
|
|
|
from PIL import ImageCms
|
|
|
|
|
2015-08-25 15:27:18 +03:00
|
|
|
import sys
|
|
|
|
sys.path.insert(0, ".")
|
|
|
|
|
2012-10-16 00:26:38 +04:00
|
|
|
try:
|
|
|
|
filename = sys.argv[1]
|
|
|
|
except IndexError:
|
|
|
|
filename = "../pil-archive/cmyk.jpg"
|
|
|
|
|
|
|
|
i = Image.open(filename)
|
|
|
|
|
|
|
|
print(i.format)
|
|
|
|
print(i.mode)
|
|
|
|
print(i.size)
|
|
|
|
print(i.tile)
|
|
|
|
|
|
|
|
p = ImageCms.getMemoryProfile(i.info["icc_profile"])
|
|
|
|
|
|
|
|
print(repr(p.product_name))
|
|
|
|
print(repr(p.product_info))
|
|
|
|
|
|
|
|
o = ImageCms.createProfile("sRGB")
|
|
|
|
t = ImageCms.buildTransformFromOpenProfiles(p, o, i.mode, "RGB")
|
|
|
|
i = ImageCms.applyTransform(i, t)
|
|
|
|
|
|
|
|
i.show()
|