Return to Snippet

Revision: 49080
at July 15, 2011 16:21 by kidrock


Initial Code
# -*- coding: utf-8 -*-
"""
Inserisce una cornice bianca nella foto selezionata
"""


import os,sys
from PIL import Image,ImageOps

WHITE_BORDER = 2
BLACK_BORDER = 20

def main(argv):

    if not os.path.exists(argv[1]):
        print "file non trovato"
        return 
    
    img = Image.open(os.path.abspath(argv[1])) # In Argv[1] sorgente
    img = ImageOps.expand(img,border = BLACK_BORDER, fill = 'black')
    img = ImageOps.expand(img,border = WHITE_BORDER, fill = 'white')
    img = ImageOps.expand(img,border = BLACK_BORDER, fill = 'black')
    
    img.save(argv[2],"JPEG") #In argv[2] il percorso + file di destinazione


if __name__ == "__main__":

    if len(sys.argv) >  1:
        main(sys.argv)

Initial URL


Initial Description


Initial Title
Create photo frame

Initial Tags
python

Initial Language
Python