Using psd_tools library to add color profile to a psd image that doesn’t have it, altering a bit the official documentation found here:-
https://psd-tools.readthedocs.io/en/latest/reference/psd_tools.html#psd_tools.PSDImage.image_resources
(under the property image_resources section) the code in question is this:- from psd_tools import PSDImage
psd = PSDImage.open(‘/home/kow_ml/Office_Work/Projects/CV/2D/PixelPIX/Data/Image/Input/final.psd’)
image = psd.compose()
icc_profile = psd.image_resources.get_data(Resource.ICC_PROFILE)
image = psd.compose(apply_icc=False)
image.save(‘/home/kow_ml/Office_Work/Projects/CV/2D/PixelPIX/Data/Image/Input/final.psd’, icc_profile=color_profile)
#assigning “color_profile” to the psd image which contains a color profile value
I am getting this error:-TypeError: compose() got an unexpected keyword argument ‘apply_icc’
I don’t know how to solve it as I am just trying to utilize official documentation code
I was expecting color_profile to be assigned as according to logic of the documentation but once I removed “image = psd.compose(apply_icc=False)” and replaced ”
image.save(‘/home/kow_ml/Office_Work/Projects/CV/2D/PixelPIX/Data/Image/Input/final.psd’, icc_profile=color_profile) ” with
“psd.save(‘/home/kow_ml/Office_Work/Projects/CV/2D/PixelPIX/Data/Image/Input/final.psd’, icc_profile=color_profile) ”
I got this new error:-TypeError: write() got an unexpected keyword argument ‘icc_profile’.
As I am saying I am trying to use the official psd_tools documentation, but that itself is showing error, any suggestions would be greatly appreciated.
S.M. Tahsin Zaman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.