Exemple #1
0
if not o.image_filename:
    if o.background:
        warn("You have requested to set the desktop background to the image that is already used for the desktop background (the default input image), so nothing to be done!")  # ,UserWarning) #,RuntimeWarning)
        o.background = False
    # strip removes trailing (and leading?) \r\n characters, so filenames with leading or trailing spaces will be corrupted
    o.image_filename = os.path.normpath(tagim.image_path_from_log().strip())  # .strip('"')
else:
    try:
        sequencenum = int(o.image_filename)
    except ValueError:
        pass

if isinstance(sequencenum, int) and not os.path.isfile(o.image_filename):
    o.image_filename = tagim.image_path_from_log(sequencenum)
if not os.path.isfile(o.image_filename):
    o.image_filename = get_background_path()
if not os.path.isfile(o.image_filename):
    raise IOError("Error: Couldn't find the image file at '{0}'".format(o.image_filename))
# else:
#     print repr(o.image_filename)

if o.verbose:
    print "Image file name: '{0}'".format(o.image_filename)

if o.angle or int(o.flip):
    if not o.angle:
        o.angle = 0.0
    if not o.flip:
        o.flip = 0
    im = tagim.rotate_image(o.image_filename, angle=round(float(o.angle), 2), flip=int(o.flip))
    p = tagim.image_path_from_log()
Exemple #2
0
    ['CANON', 'KODAK', 'SONY', 'PENTAX', 'HTC']
                         ]
EXIF_orientation_models = [['Canon PowerShot S300', 'COOLPIX L18', 'C740UZ'], ['Canon EOS 450D', 'KODAK EASYSHARE M863 DIGITAL CAMERA', 'DSC-W80', 'PENTAX K10D', 'Android Dev Phone 1']]
# whether or not to trust the GPS info from the camera
EXIF_gps_makes = [['CANON', 'NIKON', 'OLYMPUS OPTICAL CO.,LTD', 'CANON', 'KODAK', 'SONY', 'PENTAX Corporation'], ['HTC']]
EXIF_gps_models = [['Canon PowerShot S300', 'COOLPIX L18', 'C740UZ', 'Canon EOS 450D', 'KODAK EASYSHARE M863 DIGITAL CAMERA', 'DSC-W80', 'PENTAX K10D'], ['Android Dev Phone 1']]
# camera models and thier owners, a list in order from most likely photographer (byline) to least likely, for each camera
# TODO: this belongs in a database based on previously processed and bylined photos for an individual
# DEPLOY: RELEASE: delete this before deployment or release
model_byline = {'Canon PowerShot S300': ['Hobson', 'Larissa'], 'COOLPIX L18': ['Catherine', 'Larissa', 'Hobson'], 'C740UZ': ['Diane', 'Hobson', 'Larissa'], 'Canon EOS 450D': ['Larissa', 'Hobson', 'Diane'], 'KODAK EASYSHARE M863 DIGITAL CAMERA': ['Hobson', 'Larissa'], 'DSC-W80': ['Hobson', 'Carlana', 'Dewey'], 'PENTAX K10D': ['Ryan']}


# Desktop Background (DBG) paths
# DBG_PATH = os.path.realpath(os.path.join(home, '.cache', 'gnome-control-center', 'backgrounds', 'desktop_background_image_copy.jpg'))
DBG_PATH = os.path.realpath(os.path.join(home, 'Pictures', 'desktop_background_image_copy.jpg'))
DBG_PATH = gtk.get_background_path() or DBG_PATH or 'desktop_background_image_copy.jpg'
DBG_CATALOG_PATH = os.path.realpath(os.path.join(home, '.desktop_slide_show_catalog.txt'))


# use tg.get_paths.find_project_path or xapian (tracker desktop search db) similar to find a folder containing a lot of jpgs
DBG_PHOTOS_PATH = tg.get_paths.normalize_path(os.path.join(home, 'Pictures'))
DBG_LOG_PATH = tg.get_paths.normalize_path(os.path.join(home, '.desktop_background_refresh_photo_debug.log'))
DB_LOG_PATH = tg.get_paths.normalize_path(os.path.join(home, '.desktop_background_refresh_photo_catalog.log'))
DBG_DB_PATH = tg.get_paths.normalize_path(os.path.join(DBG_PHOTOS_PATH, '.tagim_photo_sqlite_database.sqlite3'))
# path to file used to set things like the unity boot up screen background
UBUNTU_SPLASH_CONFIG_PATH = '/etc/lightdm/unity-greeter.conf'


def rotate_image(filename, angle=0.0, resample='bicubic', expand=True, flip=0):
    """Rotate and/or flip the image data within a jpeg file.