Code Monkey home page Code Monkey logo

Comments (3)

LeoHsiao1 avatar LeoHsiao1 commented on August 25, 2024 1

Hi!
There are many types of metadata, so I didn't try to see if each tag could be modified.

I tried to read the tag you mentioned and found it was like this:

>>> import pyexiv2
>>> img = pyexiv2.Image(r'C:\Users\Leo\Desktop\IMG_20200105_115821.jpg')
>>> img.read_exif()['Exif.GPSInfo.GPSLongitude']
'114/1 2/1 426696/10000'

So I modified it in the same format. It works:

>>> img.modify_exif({'Exif.GPSInfo.GPSLongitude': '200/1 2/1 400000/10000'})
>>> img.read_exif()['Exif.GPSInfo.GPSLongitude']
'200/1 2/1 400000/10000'

Next, you just need to convert it from string to list:

>>> '200/1 2/1 400000/10000'.split(' ')
['200/1', '2/1', '400000/10000']
>>> ' '.join(['200/1', '2/1', '400000/10000'])
'200/1 2/1 400000/10000'

Does that solve your problem?

from pyexiv2.

xavieldar avatar xavieldar commented on August 25, 2024

Hi,

Thanks for the quick answer. Actually, that works, thanks!

I though I tried that, but I was converting Fraction object into string directly with fractions.Fraction.__str__(), which does not print out the denominator when equals to 1, which gave me:
'30 50 12345/1000' instead of '30/1 50/1 12345/1000', and would not work… This is fixed on my side and I can properly geotag images.

Thanks.

from pyexiv2.

github-actions avatar github-actions commented on August 25, 2024

This issue has been automatically closed because there has been no activity for a month.

from pyexiv2.

Related Issues (20)

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.