photography:photography-scripts
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
photography:photography-scripts [2010/10/31 13:39] – external edit 127.0.0.1 | photography:photography-scripts [2012/06/15 07:22] (current) – removed cedric | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Piwigo ====== | ||
- | <code python> | ||
- | ! / | ||
- | -*- coding: utf-8 -*- | ||
- | |||
- | """ | ||
- | |||
- | Usefull for your Piwigo gallery (http:// | ||
- | |||
- | ./piwigo | ||
- | |||
- | ./photos | ||
- | ./ | ||
- | ./pwg_high/ | ||
- | ./ | ||
- | . | ||
- | . | ||
- | ./ | ||
- | ./piwigo.py | ||
- | |||
- | Resize images from /pwg_high (original images) directory in two size : | ||
- | |||
- | - 128*128 pixels in ./ | ||
- | - 1024*768 pixels in ./ | ||
- | |||
- | """ | ||
- | |||
- | __author__ = " | ||
- | __date__ = " | ||
- | __copyright__ = " | ||
- | __license__ = "GPL v3" | ||
- | |||
- | import re import os import Image | ||
- | |||
- | def search_files(motif, | ||
- | |||
- | """ | ||
- | |||
- | Search fo files containing ' | ||
- | 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, | ||
- | result.append((os.path.join(path, | ||
- | return result | ||
- | |||
- | images = search_files(" | ||
- | |||
- | for image in images: | ||
- | |||
- | im = Image.open(image[0]) | ||
- | |||
- | im_thumbnail = im.resize((128, | ||
- | im_thumbnail.save(" | ||
- | |||
- | im_slide = im.resize((1024, | ||
- | im_slide.save(" | ||
- | |||
- | """ | ||
- | |||
- | 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 ====== | ||
- | |||
- | <code bash> | ||
- | [cedric@localhost ~]$ convert 16-04-2008_0167.jpg -font Arial -pointsize 40 -draw " | ||
- | </ | ||
- | |||
- | |||
- | ====== Effet Polaroid ====== | ||
- | |||
- | <code bash> | ||
- | 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)