photography:photography-scripts
This is an old revision of the document!
Table of Contents
Piwigo
! /usr/local/bin/python -*- coding: utf-8 -*- """piwigo.py Usefull for your Piwigo gallery (http://www.piwigo.org/). ./piwigo ./photos ./thumbnail/ ./pwg_high/ ./original_image01.jpg . . ./original_imageN.jpg ./piwigo.py Resize images from /pwg_high (original images) directory in two size : - 128*128 pixels in ./piwigo/photos/thumbnail ; - 1024*768 pixels in ./piwigo/photos/ . """ __author__ = "Cedric Bonhomme" __date__ = "$Date: 2009/03/22 $" __copyright__ = "Copyright (c) 2009 Cedric Bonhomme" __license__ = "GPL v3" import re import os import Image def search_files(motif, root_path): """Return a list of tuple (path, files). Search fo files containing 'motif' that aren't symbolic links. """ result = [] w = os.walk(root_path) for (path, dirs, files) in w: for f in files: if re.compile(motif).search(f): # if not a symbolic link if not os.path.islink(os.path.join(path, f)): result.append((os.path.join(path, f), f)) return result images = search_files(".jpg", "./photos/pwg_high") for image in images: im = Image.open(image[0]) im_thumbnail = im.resize((128, 128), Image.ANTIALIAS) im_thumbnail.save("./photos/thumbnail/TN-" + image[1], quality = 100) im_slide = im.resize((1024, 768), Image.NEAREST) im_slide.save("./photos/" + image[1], quality = 100) """ Filter options to resize the image : Use nearest neighbour : Image.NEAREST Linear interpolation in a 2x2 environment : Image.BILINEAR Cubic spline interpolation in a 4x4 environment : Image.BICUBIC Best down-sizing filter : Image.ANTIALIAS """
On peut facilement ajouter le transfert FTP du résultat dans le dossier distant qui va bien.
Watermark avec ImageMagick
[cedric@localhost ~]$ convert 16-04-2008_0167.jpg -font Arial -pointsize 40 -draw "gravity south > fill black text 0,12 'Cédric Bonhomme' > fill white text 1,11 'Cédric Bonhomme' " wmark_text_drawn.jpg
Effet Polaroid
convert picture.jpg -thumbnail 240 -bordercolor white -background black +polaroid picture-pola.png
photography/photography-scripts.1288528776.txt.gz · Last modified: 2011/08/26 00:08 (external edit)