Git Product home page Git Product logo

python-xmp-toolkit's Introduction

Python XMP Toolkit is a library for working with XMP metadata, as well as
reading/writing XMP metadata stored in many different file formats. 

Python XMP Toolkit is wrapping Exempi (using ctypes), a C/C++ XMP library
based on Adobe XMP Toolkit, ensuring that future updates to the XMP standard
are easily incorporated into the library with a minimum amount of work.

Python XMP Toolkit has been developed by: 
 * ESA/Hubble - European Space Agency 
 * ESO - European Southern Observatory
 * CRS4 - Centre for Advanced Studies, Research and Development in Sardinia

Additional documentation is included in the docs/ directory in both HTML and
PDF versions.

python-xmp-toolkit's People

Stargazers

 avatar

Watchers

 avatar

python-xmp-toolkit's Issues

XMP Not Writing to Image File

Holm,

All packages installed successfully, but the functionality does not appear
to be working.  I ran the test/test.py to embed XMP to the Tiff image, but
it did not work as expected.  The XMP was not embedded, but the file's
Modified DateTime updated...

Has the writing capability been tested?  Perhaps there is a difference
between our systems??

Something interesting to note:

I have a Python script implementing the Python Image Library to extract the
XMP packet from a Tiff image.  It references the metadata based on the
appropriate Tiff Tag (for XMP it is 700). 

Extracting the XMP using this script, and using Adobe Bridge, I expected to
have two identical files.  However, they are different.  Interestingly, the
XMP extracted using my script acknowledges the Exempi library as a toolkit.

The XMP Specs state that multiple XMP packets can exist in an image. 
Perhaps Bridge prioritizes the packet it chooses to read based on the XMP
toolkit (xmptk).

I did a few regex searches for terms like 'xpacket', 'avm', 'Exempi'.  No
avm tags were written anywhere into the image.

Attached are the two XMP files and the Python script I use to extract
metadata.  Notice 'xmptk' on the second line of each XMP file.

Any thoughts?

Original issue reported on code.google.com by [email protected] on 8 Jul 2008 at 6:04

Attachments:

PyPi release or Github hosting

Hi,

Are you planning to make a release on PyPi or to host the project on github?
This is very convenient to maintain dependencies with pip:

pip install xmp-toolkit

or 

pip install git+https://path/to/project.git

instead of :

curl -O 
http://python-xmp-toolkit.googlecode.com/files/python-xmp-toolkit-1.0.2.tar.gz
tar xvzf python-xmp-toolkit-1.0.2.tar.gz
cd python-xmp-toolkit-1.0.2
python setup.py build
python setup.py install

Thanks.

Original issue reported on code.google.com by [email protected] on 19 Nov 2014 at 2:18

Texty property limited to 255 chars?

What steps will reproduce the problem?
1. xmp = XMPFiles(
file_path="/home/clr/ruby/rails/spitzer.caltech.edu/spec/fixtures/test.tif" )
2. xmp_data = xmp.get_xmp()
3. xmp_data.get_property( "http://ns.adobe.com/photoshop/1.0/", 'Headline' )

What is the expected output? What do you see instead?
expected: A string around 450 characters long.
got: A string 255 characters long.

What version of the product are you using? On what operating system?
python-xmp-toolkit-rc1.0
Fedora GNU/Linux

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 8 May 2009 at 10:01

Further updates to documentation.

- More elaborate examples of using XMP.
- Update source code based on Adobe XMP Toolkit documentation.
- Document things you cannot do with the library

Original issue reported on code.google.com by [email protected] on 7 Mar 2009 at 2:25

Python segfaults when XMPFiles is initialized

What steps will reproduce the problem?
1. >>> import libxmp
2. >>> x = libxmp.files.XMPFiles(file_path='test/samples/BlueSquare.tif')
3. segmentation fault

What is the expected output? What do you see instead?
XMPFiles should return an instance of XMPFiles, instead python segfaults.

What version of the product are you using? On what operating system?
I checked out the latest revision of the project on November 11, 2008.

Please provide any additional information below.
The following simple patch fixes the problem:

--- 1   2008-11-11 21:59:12.000000000 -0800
+++ 2   2008-11-11 22:10:21.000000000 -0800
@@ -91,6 +91,7 @@
            _exempi = ctypes.CDLL( lib )
        else:
            _exempi = ctypes.WinDLL( lib )
+       _exempi.xmp_init()
    else:
        raise ExempiLoadError('Could not load shared library exempi.')
 except OSError, e:


The exempi library states that you must call xmp_init() before doing
anything else. Calling xmp_init() immediately after the library is loaded
solves this problem. :)

Original issue reported on code.google.com by [email protected] on 12 Nov 2008 at 6:12

Won't parse sidecar files

What steps will reproduce the problem?
1. Try to parse an xmp-file. I.e. a sidecar file from a raw file (e.g. NEF)

What is the expected output? What do you see instead?
Expect metadata, but get nothing

What version of the product are you using? On what operating system?
rc 2, test in both cygwin and linux (ubuntu)

Please provide any additional information below.

import libxmp

xmp = libxmp.file_to_dict("_DSC3129.xmp")
print xmp

Original issue reported on code.google.com by [email protected] on 7 Jun 2010 at 9:49

Cannot write to file.

What steps will reproduce the problem?
1. from libxmp import *
2. xmp = XMPFiles(
file_path="/home/clr/ruby/rails/spitzer.caltech.edu/spec/fixtures/test.tif" )
3. xmp_data = xmp.get_xmp()
4. xmp_data.set_property( "http://ns.adobe.com/photoshop/1.0/", 'Headline',
"Some really long text blurb which clearly goes longer than 255 characters
because it repeats three times because it is some really long text blurb
which clearly goes longer than 255 characters because it repeats three
times because it is some really long text blurb which clearly goes longer
than 255 characters because it repeats three times." )
5. xmp.put_xmp( xmp_data )

What is the expected output? What do you see instead?
expected: TRUE
got:
XMPFiles::PutXMP - Not open for update
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "libxmp/files.py", line 146, in put_xmp
    _check_for_error()
  File "libxmp/__init__.py", line 129, in _check_for_error
    raise XMPError( _XMP_ERROR_CODES[err] )
libxmp.XMPError: XMPErr_BadObject

What version of the product are you using? On what operating system?
python-xmp-toolkit-1.0-rc1
Fedora GNU/Linux

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 8 May 2009 at 9:59

Test failures: test_can_put_xmp, test_exempi_bad_combinations

What steps will reproduce the problem?
1. cd test
2. python test_all.py

What is the expected output? What do you see instead?

test_can_put_xmp (test_files.XMPFilesTestCase) ... XMPFiles::GetXMP - No open 
file
ERROR
test_close_file (test_files.XMPFilesTestCase) ... ok
test_exempi_bad_combinations (test_files.XMPFilesTestCase) ... XMPFiles::GetXMP 
- No open file
XMPFiles::GetXMP - No open file
XMPFiles::GetXMP - No open file
XMPFiles::GetXMP - No open file
ERROR
test_get_xmp (test_files.XMPFilesTestCase) ... XMPFiles::GetXMP - No open file
.tempsamples/BlueSquare.mov
open_usesmarthandler
1297045024
XMPFiles::GetXMP - No open file
ok
test_init_del (test_files.XMPFilesTestCase) ... ok
test_open_file (test_files.XMPFilesTestCase) ... ok
test_put_xmp (test_files.XMPFilesTestCase) ... ok
test_test_files (test_files.XMPFilesTestCase) ... ok
test_write_in_readonly (test_files.XMPFilesTestCase) ... 
.tempsamples/BlueSquare.mov
open_limitscanning
1297045024
XMPFiles::PutXMP - Not open for update
ok
test_clone (test_core_unit.XMPMetaTestCase) ... ok
test_does_property_exist (test_core_unit.XMPMetaTestCase) ... ok
test_get_localized_text (test_core_unit.XMPMetaTestCase) ... ok
test_get_xmp (test_core_unit.XMPMetaTestCase) ... ok
test_init_del (test_core_unit.XMPMetaTestCase) ... ok
test_parse_str (test_core_unit.XMPMetaTestCase) ... ok
test_serialize_and_format (test_core_unit.XMPMetaTestCase) ... Inconsistent 
options for read-only packet
Inconsistent options for non-packet serialize
Inconsistent options for exact size serialize
ok
test_serialize_str (test_core_unit.XMPMetaTestCase) ... Inconsistent options 
for read-only packet
Inconsistent options for non-packet serialize
Inconsistent options for exact size serialize
ok
test_serialize_unicode (test_core_unit.XMPMetaTestCase) ... Inconsistent 
options for read-only packet
Inconsistent options for non-packet serialize
Inconsistent options for exact size serialize
ok
test_shorthand_rdf (test_core_unit.XMPMetaTestCase) ... ok
test_test_files (test_core_unit.XMPMetaTestCase) ... ok
test_text_property_450 (test_core_unit.XMPMetaTestCase) ... ok
test_text_property_450_file (test_core_unit.XMPMetaTestCase) ... 
XMPFiles::GetXMP - No open file
XMPFiles::GetXMP - No open file
ok
test_file_to_dict (test_core_unit.UtilsTestCase) ... ok
test_file_to_dict_nofile (test_core_unit.UtilsTestCase) ... ok
test_file_to_dict_noxmp (test_core_unit.UtilsTestCase) ... ok
test_object_to_dict (test_core_unit.UtilsTestCase) ... ok
test_object_to_dict_noxmp (test_core_unit.UtilsTestCase) ... ok
test_full (__main__.LibXMPTestCase) ... ok

======================================================================
ERROR: test_can_put_xmp (test_files.XMPFilesTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/python-xmp-toolkit-1.0.2/test/test_files.py", line 122, in test_can_put_xmp
    xmp = xmpfile.get_xmp()
  File "/tmp/python-xmp-toolkit-1.0.2/libxmp/files.py", line 138, in get_xmp
    _check_for_error()
  File "/tmp/python-xmp-toolkit-1.0.2/libxmp/__init__.py", line 105, in _check_for_error
    raise XMPError( _XMP_ERROR_CODES[err] )
XMPError: XMPErr_BadObject

======================================================================
ERROR: test_exempi_bad_combinations (test_files.XMPFilesTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/python-xmp-toolkit-1.0.2/test/test_files.py", line 150, in test_exempi_bad_combinations
    xmpfile.get_xmp()
  File "/tmp/python-xmp-toolkit-1.0.2/libxmp/files.py", line 138, in get_xmp
    _check_for_error()
  File "/tmp/python-xmp-toolkit-1.0.2/libxmp/__init__.py", line 105, in _check_for_error
    raise XMPError( _XMP_ERROR_CODES[err] )
XMPError: XMPErr_BadObject

----------------------------------------------------------------------
Ran 28 tests in 1.096s

FAILED (errors=2)

What version of the product are you using? On what operating system?

python-xmp-toolkit 1.0.2, Python 2.7, exempi 2.1.1, Debian unstable

Original issue reported on code.google.com by [email protected] on 27 Jan 2012 at 11:24

file_to_dict is not defined

What steps will reproduce the problem?
1. Start python from cli
2. Write this code:

from libxmp import *
xmp = file_to_dict( "imagefile.jpg" )

What is the expected output? What do you see instead?

Excepted nothing, saw error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'file_to_dict' is not defined

What version of the product are you using? On what operating system?

Ubuntu, Intrepid ibex. Newest version of python-xmp-toolkit what I found 
available here.

Original issue reported on code.google.com by [email protected] on 27 Mar 2009 at 9:48

Unable to get XMP field

What steps will reproduce the problem?
1. from libxmp import *
2. xmpfile = XMPFiles( file_path="ECO121.pdf", open_forupdate=True )
3. xmp = xmpfile.get_xmp()
4. print xmp.get_property( libxmp.consts.XMP_NS_DC, 'format' )

What is the expected output? What do you see instead?
Expected output: "PDF-1.6"

What do I get:

Traceback (most recent call last):
  File "<pyshell#4>", line 1, in <module>
    print xmp.get_property( libxmp.consts.XMP_NS_DC, 'format' )
NameError: name 'libxmp' is not defined

What version of the product are you using? On what operating system?

python-xmp-toolkit-1.0-rc2

Ubuntu 10.04 64-bit

Python 2.6.5

Please provide any additional information below.

Original issue reported on code.google.com by [email protected] on 6 Sep 2010 at 5:52

xmp.xmpptr instead of self.xmpptr

What steps will reproduce the problem?
1. just calling method does_property_exist
2.
3.

What is the expected output? What do you see instead?
I get the error about a global name xmp not defined

What version of the product are you using? On what operating system?
xmplib 1.0/rc2 on ubuntu karmic koala

Please provide any additional information below.
in the return instruction, changing xmp.xmpptr to self.xmpptr
the problem is fixed.

Original issue reported on code.google.com by [email protected] on 24 Mar 2010 at 1:41

file_to_dict does not raise IOError on receiving non existent file

What steps will reproduce the problem?
1. from libxmp.utils import *
2. x = file_to_dict('file_that_does_not_exist')
3. print x

What is the expected output? What do you see instead?
Would have expected that IOError would be raised. Instead, x is returned as
an empty dict

What version of the product are you using? On what operating system?
svn trunk
Python 2.6 (r26:66714, Feb  3 2009, 20:52:03)
[GCC 4.3.2 [gcc-4_3-branch revision 141291]] on openSUSE 11.1

Please provide any additional information below.
Not sure if it was intended to return an empty dict if you use file_to_dict
on a non-existent file. I thus modified utils.py to import os to do a
simple if not os.path.isfile('non_existent_file'): raise IOError

I also changed object_to_dict to return an empty dictionary if xmp is None
or if xmp is a list containing no elements. Otherwise, an exception will be
raised when the method looks for xmp[-1]

I built the package (from svn trunk, including the patch already provided
for the xmpfile.open_file(file_path,
XMP_OPEN_READ=libxmp.files.XMP_OPEN_READ) issue in file_to_dict in
utils.py) for openSUSE using the openSUSE build service. Currently it's
available with one-click-install here:
http://is.gd/1QoLR

The patch I used is attached here.

If the above was expected behaviour, please tell me and i will remove the
patch from the openSUSE version

Original issue reported on code.google.com by [email protected] on 28 Jul 2009 at 10:43

Attachments:

Using file objects instead of path.

Hi,

I'am currently using your library and I am wondering : Is there a good reason 
for not offering the possibility to have the choice between a filepath and a 
file object for functions like `file_to_dict` ?

I have checked the sources and  try to figure out how to provide a patch but 
this is a lot of refactoring in the `files.py` module. Many functions rely on 
the path (_encode_as_utf8 etc) and the file is closed.

Any thought ? 

Cheers.

Stanislas.

Original issue reported on code.google.com by [email protected] on 30 Aug 2011 at 10:04

Issue with IA64 machine

Hi,

Have you experienced to use xmp-toolkit on IA64 ?
I've install exempi and run test file, no error reported,
then install xmp toolkit and i get "segmentation fault" when i
try to use it.

This problem come when i want to open file:
xmpfile = XMPFiles(file_path=bon_path, open_forupdate=files.XMP_OPEN_FORUPDATE)

My script crash. :-(((


I use:

exempi-2.1.1
python-xmp-toolkit-1.0-rc2

Linux 2.6.16.60-0.42.7-default #1 SMP Tue Nov 3 11:20:42 UTC 2009 ia64 ia64 
ia64 GNU/Linux

XFS filesystem

Python 2.7 (r27:82500, Nov 16 2010, 19:10:04) 
[GCC 4.1.2 20070115 (SUSE Linux)] on linux2

Best Regards

Original issue reported on code.google.com by [email protected] on 7 Dec 2010 at 9:13

UnboundLocalError when calling append_array_item with array_options

What steps will reproduce the problem?
1. xmp.append_array_items(namespace, 'foo', 'bar',
array_options=dict(prop_value_is_array=XMP_PROP_VALUE_IS_ARRAY))
2.
3.

What is the expected output? What do you see instead?
Expected an array to get added to the xmp. Instead, got an UnboundLocalError.
UnboundLocalError: local variable 'options' referenced before assignment


What version of the product are you using? On what operating system?
1.0-rc1. But it looks like the current trunk (r39) has this issue too by
looking at the source. I'm on fedora 10, python2.5

Please provide any additional information below.
The issue looks like a simple spelling error. Here's the patch that fixed
it for me:

Index: core.py
===================================================================
--- core.py     (revision 39)
+++ core.py     (working copy)
@@ -269,7 +269,7 @@
                :return True if the array item was appended correctly,
False otherwise.
                :rtype bool
                """
-               array_options = options.mask(XMP_PROP_OPTIONS,
**array_options) if array_options else 0
+               array_options = options_mask(XMP_PROP_OPTIONS,
**array_options) if array_options else 0
                options = options_mask(XMP_PROP_OPTIONS, **kwargs) if
kwargs else 0
                return bool(_exempi.xmp_append_array_item(self.xmpptr,
schema_ns, array_name, array_options, item_value, options))



Original issue reported on code.google.com by [email protected] on 10 May 2009 at 3:50

file_to_dict passes kwarg as positional arg.

What steps will reproduce the problem?
>>> from libxmp.utils import file_to_dict
>>> file_to_dict('sample.eps')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "libxmp/utils.py", line 68, in file_to_dict
    xmpfile.open_file(file_path, libxmp.files.XMP_OPEN_READ)
TypeError: open_file() takes exactly 2 arguments (3 given) 


What is the expected output? What do you see instead?
This function should return a dictionary. 
The second argument is passed as a positional argument and not a keyword
argument like 'open_file' requires. Changing the argument to a keyword
argument (in this case 'XMP_OPEN_READ' solves that problem but reveals
others (please see the attached patch).


What version of the product are you using? On what operating system?
python-xmp-toolkit 1.0-rc1 on Linux

Please provide any additional information below.
I have attached a patch that fixes these bugs.


Original issue reported on code.google.com by [email protected] on 18 Mar 2009 at 6:08

Attachments:

Nested Arrays

What steps will reproduce the problem?
1. x = XMPMeta()
2. x.set_property(XMP_NS_DM, 'tracks','',prop_value_is_array = 
XMP_PROP_VALUE_IS_ARRAY,                                                        
                    prop_array_is_unordered = XMP_PROP_ARRAY_IS_UNORDERED)
3. x.set_array_item(XMP_NS_DM, 'tracks', 1, 'markers', 
array_options={'prop_value_is_array':XMP_PROP_VALUE_IS_ARRAY, 
'prop_array_is_ordered':XMP_PROP_ARRAY_IS_ORDERED } )
4. print x

What is the expected output? What do you see instead?
I expect to see something like:

...
 <xmpDM:tracks>
    <rdf:Bag>
     <rdf:li>
      <rdf:Description>
       <xmpDM:markers>
        <rdf:Seq>
        </rdf:Seq>
       </xmpDM:markers>
      </rdf:Description>
     </rdf:li>
    </rdf:Bag>
   </xmpDM:tracks>
...



but I see:

...
 <xmpDM:tracks>
    <rdf:Bag>
     <rdf:li>markers</rdf:li>
    </rdf:Bag>
   </xmpDM:tracks>
...


What version of the product are you using? On what operating system?
1.0.2


Please provide any additional information below.

An example of this kind of tree here: 
http://www.notredam.org/NotreDAM/Documentation_files/2010-crs4-xmp-analysis.pdf

Original issue reported on code.google.com by [email protected] on 7 Sep 2011 at 3:44

adding own property deletes (all) others

What steps will reproduce the problem?
1. x=libxmp.XMPMeta()
2. f=libxmp.XMPFiles()
3. f.open_file('/tmp/2012.08.12-12.24-4874.JPG', open_forupdate=True)
4. x.register_namespace('http://actr.lu/actr/xmp/0.1/', 'actr')
5. x.set_property('http://actr.lu/actr/xmp/0.1/', 'version', '0.0.1')
6. f.get_xmp()
<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Exempi + XMP Core 5.1.2">
 <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <rdf:Description rdf:about=""
    xmlns:tiff="http://ns.adobe.com/tiff/1.0/">
   <tiff:Orientation>1</tiff:Orientation>
   <tiff:YCbCrPositioning>2</tiff:YCbCrPositioning>
   <tiff:XResolution>300/1</tiff:XResolution>
   <tiff:YResolution>300/1</tiff:YResolution>
   <tiff:ResolutionUnit>2</tiff:ResolutionUnit>
   <tiff:Make>NIKON</tiff:Make>
   <tiff:Model>COOLPIX P50</tiff:Model>
  </rdf:Description>
  <rdf:Description rdf:about=""
    xmlns:xmp="http://ns.adobe.com/xap/1.0/">
   <xmp:CreatorTool>COOLPIX P50V1.0</xmp:CreatorTool>
   <xmp:ModifyDate>2012-08-12T10:24:42</xmp:ModifyDate>
   <xmp:CreateDate>2012-08-12T10:24:42</xmp:CreateDate>
  </rdf:Description>
  <rdf:Description rdf:about=""
    xmlns:exif="http://ns.adobe.com/exif/1.0/">
   <exif:ColorSpace>1</exif:ColorSpace>
   <exif:CompressedBitsPerPixel>4/1</exif:CompressedBitsPerPixel>
   <exif:PixelXDimension>1200</exif:PixelXDimension>
   <exif:PixelYDimension>1600</exif:PixelYDimension>
   <exif:ExposureTime>10/89</exif:ExposureTime>
   <exif:FNumber>28/10</exif:FNumber>
   <exif:ExposureProgram>2</exif:ExposureProgram>
   <exif:ExposureBiasValue>0/10</exif:ExposureBiasValue>
   <exif:MaxApertureValue>30/10</exif:MaxApertureValue>
   <exif:MeteringMode>5</exif:MeteringMode>
   <exif:LightSource>0</exif:LightSource>
   <exif:FocalLength>47/10</exif:FocalLength>
   <exif:CustomRendered>0</exif:CustomRendered>
   <exif:ExposureMode>0</exif:ExposureMode>
   <exif:WhiteBalance>0</exif:WhiteBalance>
   <exif:DigitalZoomRatio>0/100</exif:DigitalZoomRatio>
   <exif:FocalLengthIn35mmFilm>28</exif:FocalLengthIn35mmFilm>
   <exif:SceneCaptureType>0</exif:SceneCaptureType>
   <exif:GainControl>2</exif:GainControl>
   <exif:Contrast>0</exif:Contrast>
   <exif:Saturation>0</exif:Saturation>
   <exif:Sharpness>0</exif:Sharpness>
   <exif:SubjectDistanceRange>0</exif:SubjectDistanceRange>
   <exif:DateTimeOriginal>2012-08-12T10:24:42</exif:DateTimeOriginal>
   <exif:ISOSpeedRatings>
    <rdf:Seq>
     <rdf:li>400</rdf:li>
    </rdf:Seq>
   </exif:ISOSpeedRatings>
   <exif:ExifVersion>0220</exif:ExifVersion>
   <exif:FlashpixVersion>0100</exif:FlashpixVersion>
   <exif:ComponentsConfiguration>
    <rdf:Seq>
     <rdf:li>1</rdf:li>
     <rdf:li>2</rdf:li>
     <rdf:li>3</rdf:li>
     <rdf:li>0</rdf:li>
    </rdf:Seq>
   </exif:ComponentsConfiguration>
   <exif:UserComment>
    <rdf:Alt>
     <rdf:li xml:lang="x-default">                                                                                                                     </rdf:li>
    </rdf:Alt>
   </exif:UserComment>
   <exif:Flash rdf:parseType="Resource">
    <exif:Fired>False</exif:Fired>
    <exif:Return>0</exif:Return>
    <exif:Mode>2</exif:Mode>
    <exif:Function>False</exif:Function>
    <exif:RedEyeMode>False</exif:RedEyeMode>
   </exif:Flash>
   <exif:FileSource>3</exif:FileSource>
   <exif:SceneType>1</exif:SceneType>
  </rdf:Description>
  <rdf:Description rdf:about=""
    xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/">
   <photoshop:DateCreated>2012-08-12T10:24:42</photoshop:DateCreated>
  </rdf:Description>
 </rdf:RDF>
</x:xmpmeta>





















<?xpacket end="w"?>
7. f.can_put_xmp(x) / returns 1
8. f.close_file()
9. f.open_file('/tmp/2012.08.12-12.24-4874.JPG')
10. f.get_xmp()
<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Exempi + XMP Core 5.1.2">
 <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <rdf:Description rdf:about=""
    xmlns:actr="http://zeininger.lu/actr/xmp/0.1/">
   <actr:version>0.0.1</actr:version>
  </rdf:Description>
  <rdf:Description rdf:about=""
    xmlns:tiff="http://ns.adobe.com/tiff/1.0/">
   <tiff:Orientation>1</tiff:Orientation>
   <tiff:YCbCrPositioning>2</tiff:YCbCrPositioning>
   <tiff:XResolution>300/1</tiff:XResolution>
   <tiff:YResolution>300/1</tiff:YResolution>
   <tiff:ResolutionUnit>2</tiff:ResolutionUnit>
   <tiff:Make>NIKON</tiff:Make>
   <tiff:Model>COOLPIX P50</tiff:Model>
  </rdf:Description>
  <rdf:Description rdf:about=""
    xmlns:exif="http://ns.adobe.com/exif/1.0/">
   <exif:ColorSpace>1</exif:ColorSpace>
   <exif:CompressedBitsPerPixel>4/1</exif:CompressedBitsPerPixel>
   <exif:PixelXDimension>1200</exif:PixelXDimension>
   <exif:PixelYDimension>1600</exif:PixelYDimension>
   <exif:ExposureTime>10/89</exif:ExposureTime>
   <exif:FNumber>28/10</exif:FNumber>
   <exif:ExposureProgram>2</exif:ExposureProgram>
   <exif:ExposureBiasValue>0/10</exif:ExposureBiasValue>
   <exif:MaxApertureValue>30/10</exif:MaxApertureValue>
   <exif:MeteringMode>5</exif:MeteringMode>
   <exif:LightSource>0</exif:LightSource>
   <exif:FocalLength>47/10</exif:FocalLength>
   <exif:CustomRendered>0</exif:CustomRendered>
   <exif:ExposureMode>0</exif:ExposureMode>
   <exif:WhiteBalance>0</exif:WhiteBalance>
   <exif:DigitalZoomRatio>0/100</exif:DigitalZoomRatio>
   <exif:FocalLengthIn35mmFilm>28</exif:FocalLengthIn35mmFilm>
   <exif:SceneCaptureType>0</exif:SceneCaptureType>
   <exif:GainControl>2</exif:GainControl>
   <exif:Contrast>0</exif:Contrast>
   <exif:Saturation>0</exif:Saturation>
   <exif:Sharpness>0</exif:Sharpness>
   <exif:SubjectDistanceRange>0</exif:SubjectDistanceRange>
   <exif:ISOSpeedRatings>
    <rdf:Seq>
     <rdf:li>400</rdf:li>
    </rdf:Seq>
   </exif:ISOSpeedRatings>
   <exif:ExifVersion>0220</exif:ExifVersion>
   <exif:FlashpixVersion>0100</exif:FlashpixVersion>
   <exif:ComponentsConfiguration>
    <rdf:Seq>
     <rdf:li>1</rdf:li>
     <rdf:li>2</rdf:li>
     <rdf:li>3</rdf:li>
     <rdf:li>0</rdf:li>
    </rdf:Seq>
   </exif:ComponentsConfiguration>
   <exif:Flash rdf:parseType="Resource">
    <exif:Fired>False</exif:Fired>
    <exif:Return>0</exif:Return>
    <exif:Mode>2</exif:Mode>
    <exif:Function>False</exif:Function>
    <exif:RedEyeMode>False</exif:RedEyeMode>
   </exif:Flash>
   <exif:FileSource>3</exif:FileSource>
   <exif:SceneType>1</exif:SceneType>
  </rdf:Description>
 </rdf:RDF>
</x:xmpmeta>





















<?xpacket end="w"?>

What is the expected output? What do you see instead?
all other xmp: tags are gone

What version of the product are you using? On what operating system?
python-xmp-toolkit==1.0.2
Python 2.7.3
Debian 3.2.0-3-amd64 #1 SMP Mon Jul 23 02:45:17 UTC 2012 x86_64 GNU/Linux

Please provide any additional information below.

Original issue reported on code.google.com by [email protected] on 30 Oct 2012 at 6:25

"make runtests" broken

What steps will reproduce the problem?
1. Run "make runtests".

What is the expected output? What do you see instead?

According to the documentation, this should run the testsuite, but it doesn't 
quite work:

$ make runtests
env PYTHONPATH=.:YTHONPATH python test/test_all.py
test_can_put_xmp (test_files.XMPFilesTestCase) ... ERROR
test_close_file (test_files.XMPFilesTestCase) ... ERROR
test_exempi_bad_combinations (test_files.XMPFilesTestCase) ... ERROR
test_get_xmp (test_files.XMPFilesTestCase) ... ERROR
test_init_del (test_files.XMPFilesTestCase) ... ERROR
test_open_file (test_files.XMPFilesTestCase) ... ERROR
test_put_xmp (test_files.XMPFilesTestCase) ... ERROR
test_test_files (test_files.XMPFilesTestCase) ... ERROR
test_write_in_readonly (test_files.XMPFilesTestCase) ... ERROR
test_clone (test_core_unit.XMPMetaTestCase) ... ERROR
test_does_property_exist (test_core_unit.XMPMetaTestCase) ... ERROR
test_get_localized_text (test_core_unit.XMPMetaTestCase) ... ERROR
test_get_xmp (test_core_unit.XMPMetaTestCase) ... ERROR
test_init_del (test_core_unit.XMPMetaTestCase) ... ERROR
test_parse_str (test_core_unit.XMPMetaTestCase) ... ERROR
test_serialize_and_format (test_core_unit.XMPMetaTestCase) ... ERROR
test_serialize_str (test_core_unit.XMPMetaTestCase) ... ERROR
test_serialize_unicode (test_core_unit.XMPMetaTestCase) ... ERROR
test_shorthand_rdf (test_core_unit.XMPMetaTestCase) ... ERROR
test_test_files (test_core_unit.XMPMetaTestCase) ... ERROR
test_text_property_450 (test_core_unit.XMPMetaTestCase) ... ERROR
test_text_property_450_file (test_core_unit.XMPMetaTestCase) ... ERROR
test_file_to_dict (test_core_unit.UtilsTestCase) ... ERROR
test_file_to_dict_nofile (test_core_unit.UtilsTestCase) ... ERROR
test_file_to_dict_noxmp (test_core_unit.UtilsTestCase) ... ERROR
test_object_to_dict (test_core_unit.UtilsTestCase) ... ERROR
test_object_to_dict_noxmp (test_core_unit.UtilsTestCase) ... ERROR
test_full (__main__.LibXMPTestCase) ... ERROR

======================================================================
ERROR: test_can_put_xmp (test_files.XMPFilesTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/python-xmp-toolkit-1.0.2/test/test_files.py", line 49, in setUp
    make_temp_samples()
  File "/tmp/python-xmp-toolkit-1.0.2/test/samples.py", line 92, in make_temp_samples
    shutil.copytree('samples', sampledir)
  File "/usr/lib/python2.7/shutil.py", line 169, in copytree
    names = os.listdir(src)
OSError: [Errno 2] No such file or directory: 'samples'

======================================================================
ERROR: test_close_file (test_files.XMPFilesTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/python-xmp-toolkit-1.0.2/test/test_files.py", line 49, in setUp
    make_temp_samples()
  File "/tmp/python-xmp-toolkit-1.0.2/test/samples.py", line 92, in make_temp_samples
    shutil.copytree('samples', sampledir)
  File "/usr/lib/python2.7/shutil.py", line 169, in copytree
    names = os.listdir(src)
OSError: [Errno 2] No such file or directory: 'samples'

[snip - even more failures]

Ran 28 tests in 0.009s

FAILED (errors=28)

What version of the product are you using? On what operating system?
python-xml-toolkit 1.0.2, Python 2.7, Debian unstable

Original issue reported on code.google.com by [email protected] on 27 Jan 2012 at 11:10

bug in does_property_exist

calling the method does_property_exist raises the exception: global name xmp is 
not defined

bug is located at line 457: xmp.xmpptr instead of self.xmpptr

fixed in my local installation, it seems to work :)

ghira

Original issue reported on code.google.com by [email protected] on 14 Apr 2010 at 12:06

  • Merged into: #11

Own xmp

Cannot add own xmp tag with

What steps will reproduce the problem?

When i try
xmpfile = 
XMPFiles(file_path="/file/configs/pdf/pdf13.pdf",open_forupdate=files.XMP_OPEN_F
ORUPDATE)
xmp = xmpfile.get_xmp()
xmp.set_property("http://my-networks.com/xmp/private/",'ecq:Original_FileName','
reference 
file.pdf')
xmpfile.put_xmp(xmp)
xmpfile.close_file() 

i get this :
Unregistered schema namespace URI
and the file isn't updated.

If i take a pdf and put my own xmp with acrobat on then use
this pdf to correct xmp they works !!

But if i'm trying to put value with variable in xmp.set_property
exemple:
xmpfile = 
XMPFiles(file_path="/file/configs/pdf/pdf13.pdf",open_forupdate=files.XMP_OPEN_F
ORUPDATE)
xmp = xmpfile.get_xmp()
NameSpace = "http://my-networks.com/xmp/private/"
ValueName = 'ecq:Original_FileName'
ValueVal = 'reference file.pdf'
xmp.set_property(NameSpace,ValueName,ValueVal)
xmpfile.put_xmp(xmp)
xmpfile.close_file() 
i get this :
Unregistered schema namespace URI
and the file isn't updated.




What version of the product are you using? On what operating system?
exempi-2.1.1
python-xmp-toolkit-1.0-rc1
RHEL5
Linux 2.6.18-164.9.1.el5 #1 SMP Wed Dec 9 03:27:37 EST 2009 x86_64 x86_64 
x86_64 
GNU/Linux


Please provide any additional information below.

Original issue reported on code.google.com by [email protected] on 13 Jan 2010 at 2:59

get_xmp() returning None

I want to _add_ xmp to an existing PDF file which doesn't have xmp data yet. I 
tried opening the existing file:
>>> from libxmp import *
>>> xmpfile = XMPFiles( file_path="1.pdf")
>>> xmp = xmpfile.get_xmp()
>>> print type(xmp)
<type 'NoneType'>

I read on http://forums.adobe.com/thread/708717 that it does not seem to be 
possible to inject xmp data into an already existing PDF from their toolkit.

Thus, do I have to use something like acrobat to create the PDF first or is it 
in some way possible for python-xmp-toolkit to inject xmp?

Original issue reported on code.google.com by [email protected] on 24 Apr 2012 at 3:15

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.