Open jseabold opened 11 years ago
I am using lcms version 1.19. I will see if I can test it with newer version of lcms. Meanwhile, can you post your error messages?
It looks like lcms.cmsOpenProfileFromFile
is gone and it's now just lcms.FileProfile
. That's as far as I got making changes, because it looked obvious.
[~/src/mpl_ps_cmyk] (master)
|11 $ git diff
diff --git a/mpl_toolkits/ps_cmyk/rgb2cmyk.py b/mpl_toolkits/ps_cmyk/rgb2cmyk.py
index f2a92cb..2eec2fa 100644
--- a/mpl_toolkits/ps_cmyk/rgb2cmyk.py
+++ b/mpl_toolkits/ps_cmyk/rgb2cmyk.py
@@ -10,9 +10,13 @@ class RGB2CMYK(object):
self._cmyk_profile_name = cmyk_profile_name
print self._rgb_profile_name, self._cmyk_profile_name
-
- self.RGB_profile = lcms.cmsOpenProfileFromFile(self._rgb_profile_name
- self.CMYK_profile = lcms.cmsOpenProfileFromFile(self._cmyk_profile_nam
+
+ try:
+ self.RGB_profile = lcms.cmsOpenProfileFromFile(self._rgb_profile_
+ self.CMYK_profile = lcms.cmsOpenProfileFromFile(self._cmyk_profile
+ except TypeError: # API Change?
+ self.RGB_profile = lcms.FileProfile(self._rgb_profile_name, "r")
+ self.CMYK_profile = lcms.FileProfile(self._cmyk_profile_name, "r")
self.RGB2CMYK_transform = lcms.cmsCreateTransform(self.RGB_profile,
lcms.TYPE_RGB_8,
This is the output of examples/test.py
with the above change.
[~/src/mpl_ps_cmyk/examples] (master)
|9 $ python test.py
/usr/local/lib/python2.7/dist-packages/mpl_toolkits/ps_cmyk/icc-profiles/sRGB.icm /usr/local/lib/python2.7/dist-packages/mpl_toolkits/ps_cmyk/icc-profiles/USWebCoatedSWOP.icc
Traceback (most recent call last):
File "test.py", line 15, in <module>
plt.savefig("test_cmyk.eps", format="eps_cmyk")
File "/usr/local/lib/python2.7/dist-packages/matplotlib-1.3.x-py2.7-linux-x86_64.egg/matplotlib/pyplot.py", line 477, in savefig
return fig.savefig(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/matplotlib-1.3.x-py2.7-linux-x86_64.egg/matplotlib/figure.py", line 1390, in savefig
self.canvas.print_figure(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/matplotlib-1.3.x-py2.7-linux-x86_64.egg/matplotlib/backend_bases.py", line 2132, in print_figure
**kwargs)
File "/usr/local/lib/python2.7/dist-packages/matplotlib-1.3.x-py2.7-linux-x86_64.egg/matplotlib/backend_bases.py", line 1984, in _print_method
return print_method(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/mpl_toolkits/ps_cmyk/backend_ps_cmyk.py", line 84, in print_eps_cmyk
return self._print_ps(outfile, 'eps', *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/matplotlib-1.3.x-py2.7-linux-x86_64.egg/matplotlib/backends/backend_ps.py", line 1007, in _print_ps
**kwargs)
File "/usr/local/lib/python2.7/dist-packages/matplotlib-1.3.x-py2.7-linux-x86_64.egg/matplotlib/backends/backend_ps.py", line 1100, in _print_figure
self.figure.draw(renderer)
File "/usr/local/lib/python2.7/dist-packages/matplotlib-1.3.x-py2.7-linux-x86_64.egg/matplotlib/artist.py", line 54, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/matplotlib-1.3.x-py2.7-linux-x86_64.egg/matplotlib/figure.py", line 1025, in draw
func(*args)
File "/usr/local/lib/python2.7/dist-packages/matplotlib-1.3.x-py2.7-linux-x86_64.egg/matplotlib/artist.py", line 54, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/matplotlib-1.3.x-py2.7-linux-x86_64.egg/matplotlib/axes.py", line 2088, in draw
a.draw(renderer)
File "/usr/local/lib/python2.7/dist-packages/matplotlib-1.3.x-py2.7-linux-x86_64.egg/matplotlib/artist.py", line 54, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/matplotlib-1.3.x-py2.7-linux-x86_64.egg/matplotlib/image.py", line 365, in draw
renderer.draw_image(gc, l, b, im)
File "/usr/local/lib/python2.7/dist-packages/matplotlib-1.3.x-py2.7-linux-x86_64.egg/matplotlib/backends/backend_ps.py", line 471, in draw_image
h, w, bits, imagecmd = self._get_image_h_w_bits_command(im)
File "/usr/local/lib/python2.7/dist-packages/mpl_toolkits/ps_cmyk/backend_ps_cmyk.py", line 38, in _get_image_h_w_bits_command
h, w, bits = self._cmyk(im)
File "/usr/local/lib/python2.7/dist-packages/mpl_toolkits/ps_cmyk/backend_ps_cmyk.py", line 23, in _cmyk
self.check_porfile()
File "/usr/local/lib/python2.7/dist-packages/mpl_toolkits/ps_cmyk/backend_ps_cmyk.py", line 56, in check_porfile
cls.set_default_profiles()
File "/usr/local/lib/python2.7/dist-packages/mpl_toolkits/ps_cmyk/backend_ps_cmyk.py", line 51, in set_default_profiles
cls.use_profiles(rgb_name, cmyk_name)
File "/usr/local/lib/python2.7/dist-packages/mpl_toolkits/ps_cmyk/backend_ps_cmyk.py", line 63, in use_profiles
rgb2cmyk = RGB2CMYK(_rgb, _cmyk)
File "/usr/local/lib/python2.7/dist-packages/mpl_toolkits/ps_cmyk/rgb2cmyk.py", line 14, in __init__
self.RGB_profile = lcms.FileProfile(self._rgb_profile_name, "r")
TypeError: function takes at most 1 argument (2 given)
Exception AttributeError: "'module' object has no attribute 'cmsDeleteTransform'" in <bound method RGB2CMYK.__del__ of <mpl_toolkits.ps_cmyk.rgb2cmyk.RGB2CMYK object at 0x394b1d0>> ignored
Do you know the version requirements for lcms? I seem to be running into some API changes in version 2.5 unless I have a bad install.