Click here to Skip to main content
15,847,427 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i install pyexiv2 library.
but i found that i can't use all atribute of this library such as write, ImageMetadata, show ...

when i try to use them this errors shown up:
AttributeError: 'Image' object has no attribute 'write'
AttributeError: module 'pyexiv2' has no attribute 'ImageMetadata'

What I have tried:

Python
import pyexiv2
# Load the image
image = pyexiv2.Image('image.jpg')
# Load the XMP data from the preset file
xmp_data = open('filter.xmp', 'r').read()
# Apply the XMP data to the image
image.modify_raw_xmp(xmp_data)

image.write()
Posted
Updated 18-Feb-23 7:44am
v2

If in doubt, check the documentation. A quick google takes you to it: pyexiv2.Image - Google Search[^]
The top link takes you to the official documents, and a trivial search t5here gets yo0u to the Image info: API documentation — py3exiv2 0.3.0 documentation[^] which includes a write_to_filemethod:
Quote:
write_to_file(path)
Write the thumbnail image to a file on disk. The file extension will be automatically appended to the path.

Argument:

path str(Path to write the thumbnail to) - without an extension.

Was that what you needed to use?
 
Share this answer
 
Comments
anwar machkour 18-Feb-23 10:53am    
I don't understand you. i install pyexiv2, but i can use a few attribute.
in the documentation, we can see ImageMetadata, show, write attribute. but in pycharm, i can't use them.
The message is telling you that the object created by pyexiv2.Image('image.jpg') does not have a write method. Check the documentation to see why.
 
Share this answer
 
Comments
anwar machkour 18-Feb-23 10:54am    
but in the documentation, there exist ImageMetadata, show, write attribute. but in pycharm, i can't use them.
Richard MacCutchan 18-Feb-23 10:56am    
Yes, but you are not using ImageMetadata.
anwar machkour 18-Feb-23 11:04am    
like the write attribute, when i try to use it, an error shown up:[module 'pyexiv2' has no attribute 'ImageMetadata'].
I don't know where is the problem, why some attribute didn't install.
Richard MacCutchan 18-Feb-23 11:47am    
Sorry, we cannot guess what you are doing. Please use the Improve question link above, and add complete details of what is not working.
Richard MacCutchan 18-Feb-23 12:18pm    
I have installed pyexiv2 and examined the library but it seems quite different from what is documented on the website.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900