Posts Tagged ‘python’

How to fix picture’s Date Taken

Ever downloaded your vacation pictures from your digital camera, just to discover that the Date Taken tag is wrong? There is a solution for that! You just need python, shell script and probably Linux skills, and ten minutes to spare.

The following lines will do the magic for you:

import pyexiv2
from datetime import timedelta
import sys

metadata = pyexiv2.ImageMetadata(sys.argv[1])
metadata.read()
tag = metadata['Exif.Image.DateTime']
if tag.value.year == 2011:
   tag.value += timedelta(days=366)
   metadata.write()

To keep things simple, I just assumed that you will run this script with the jpeg image as a parameter, and the pictures appear to be taken last year (happened to me).

To fix all the pictures in a folder, simply run this oneline:

for i in *.JPG; do python fix.py $i; done

There you go!

Later Edit: you would probably also want to change Exif.Photo.DateTimeOriginal and Exif.Photo.DateTimeDigitized tags.




Editor imagine xsplash pentru ubuntu 9.10

Pentru că abia a trecut ACM-ul, mâine este UIFv3, nu am mai scris de ceva timp cod, iar AJ mă bătea la cap cu întreba despre un nou xsplash de modificat (după cel de la USO), am scris un mic GUI peste imagemagick care micșorează numărul de pași pentru personalizarea ecranului de login.

Arată așa (ignorând Terminatorul din spate):

xste-1

și face cam ce zice.

xste-2Exemplu pentru laboratorul de USO.

Sursa: xsplash-theme-editor-0.1.tar.gz .

LE: v0.2 cu surse și pachet .deb :D

Enjoy! Btw, the new ubuntu is awesome.