luismanolo avatar luismanolo committed fdf7640

Varios cambios

Comments (0)

Files changed (33)

Imagenes/Agregar borde

-#!/usr/bin/env python
-# -*- coding: latin-1 -*-
-
-# Creado por Pedro Guridi
-
-import gtk
-import os, sys
-import string
-
-sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])),".."))
-import Process
-
-# VARIABLES POR DEFECTO
-size = '5'
-
-def ClickAceptar(widget):
-	archivos = os.environ['NAUTILUS_SCRIPT_SELECTED_FILE_PATHS'].split("\n")
-	size = str(int(spinTam.get_value()))
-	color = colorbutton.get_color()
-	colorstring = gtk.color_selection_palette_to_string([colorbutton.get_color()])
-	color = colorstring
-	for archivo in archivos:
-		if archivo != "":
-			if os.path.isdir(archivo):
-				ProcesarDirectorio(archivo, size, color)
-			else:
-				ProcesarImagen(archivo, size, color)
-
-	Process.alert("El proceso ha finalizado satisfactoriamente")
-	gtk.main_quit()
-
-def ProcesarDirectorio(directorio, size, color):
-	archivos = os.listdir(directorio)
-	for archivo in archivos:
-		archivo = directorio + "/" + archivo
-		if os.path.isdir(archivo):
-			ProcesarDirectorio(archivo, size, color)
-		else:
-			ProcesarImagen(archivo, size, color)
-
-def ProcesarImagen(archivo, size, color):
-	if Process.getExtension(archivo) == "JPG" or Process.getExtension(archivo) == "PNG":
-		image = gtk.gdk.pixbuf_new_from_file( archivo )		
-		Process.ProcessFileByArgument("convert -border " + size + "x" + size + " -bordercolor " + color +  " \""+archivo+"\" \""+archivo+"\"")
-
-def ClickCancelar(widget):
-	gtk.main_quit()
-
-
-if Process.verifyCommands("convert%ImageMagick")==False:
-	sys.exit()
-	
-	
-w = gtk.Window(gtk.WINDOW_TOPLEVEL)
-w.set_title("Agregar borde")
-w.set_border_width(20)
-
-w.connect("destroy", gtk.mainquit) 
-#l = gtk.Label(os.environ['NAUTILUS_SCRIPT_SELECTED_FILE_PATHS'])
-
-table = gtk.Table(3, 2, False)
-
-table.set_row_spacings(5)
-table.set_col_spacings(5)
-
-lAncho = gtk.Label("Ancho:")
-table.attach(lAncho, 0, 1, 0, 1)
-
-adjTam = gtk.Adjustment(1.0, 1.0, 999999.0, 1.0, 5.0, 0.0)
-spinTam = gtk.SpinButton(adjTam, 0, 0)
-spinTam.set_value(5)
-table.attach(spinTam, 1, 2, 0, 1)
-
-color = gtk.Label("Color:")
-table.attach(color, 0, 1, 1, 2)
-
-colorbutton = gtk.ColorButton(color=gtk.gdk.Color(0,0,0))
-colorbutton.set_title('Selecciona un color')
-table.attach(colorbutton, 1, 2, 1, 2)
-
-# botones
-aligBotones = gtk.Alignment(1.0, 0.0)
-boxBotones = gtk.HBox(True, 4)
-
-bAceptar = gtk.Button("Aceptar", gtk.STOCK_OK)
-bAceptar.connect("clicked", ClickAceptar)
-
-boxBotones.pack_start(bAceptar, False, False, 0)
-bCancelar = gtk.Button("Cancelar", gtk.STOCK_CANCEL)
-bCancelar.connect("clicked", ClickCancelar)
-
-boxBotones.pack_start(bCancelar, False, False, 0)
-aligBotones.add(boxBotones)
-table.attach(aligBotones, 1, 2, 4, 5)
-
-w.add(table)
-w.show_all()
-gtk.main()

Imagenes/Agregar sombra

-#!/usr/bin/env python
-# -*- coding: latin-1 -*-
-
-import gtk
-import os, sys
-import string
-
-sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])),".."))
-import Process
-
-colorBg = "#FFFFFF"
-colorBg1 = "#562525"
-colorBg2 = "#784949"
-
-def ClickAceptar(widget):
-	archivos = os.environ['NAUTILUS_SCRIPT_SELECTED_FILE_PATHS'].split("\n")
-	for archivo in archivos:
-		if archivo != "":
-			if os.path.isdir(archivo):
-				ProcesarDirectorio(archivo)
-			else:
-				ProcesarImagen(archivo)
-
-	Process.alert("El proceso ha finalizado satisfactoriamente")
-	gtk.main_quit()
-
-def ProcesarDirectorio(directorio):
-	archivos = os.listdir(directorio)
-	for archivo in archivos:
-		archivo = directorio + "/" + archivo
-		if os.path.isdir(archivo):
-			ProcesarDirectorio(archivo)
-		else:
-			ProcesarImagen(archivo)
-
-def ProcesarImagen(archivo):
-	if Process.getExtension(archivo) == "JPG" or Process.getExtension(archivo) == "PNG":
-
-		blur = int(spinTam.get_value())
-		sepX = int(spinSepX.get_value())
-		sepY = int(spinSepY.get_value())
-
-		fileNameCopy = Process.getName(archivo) + "_copy.png"
-		fileCopy = Process.getPath(archivo) + "/" + fileNameCopy
-
-		fileNameShadow = Process.getName(archivo) + "_shadow.png"
-		fileShadow = Process.getPath(archivo) + "/" + fileNameShadow
-
-		pb = gtk.gdk.pixbuf_new_from_file( archivo )
-
-
-		#Process.ProcessFileByArgument(
-		#	"convert -size " + str(pb.get_width()+(sepX*2)) + "x" + str(pb.get_height()+(sepY*2)) + " gradient:#ffffff-#ffffff -draw \"image Over " + str(sepX) + "," + str(sepY) + " "+str(pb.get_width())+","+str(pb.get_height())+" '" + archivo + "'\" \"" + fileCopy + "\"")
-
-		Process.ProcessFileByArgument(
-			"convert \"" + archivo + "\" \"" + fileCopy + "\"")	
-
-		Process.ProcessFileByArgument(
-			"convert -background none -fill transparent -bordercolor transparent -border 10 -background none \"" + fileCopy + "\" \"" + fileCopy + "\"")
-
-		Process.ProcessFileByArgument(
-			"convert \"" + fileCopy + "\"  -channel A  -blur 0x" + str(blur) + "  -channel RG -fx 0  -channel B -fx .25 \"" + fileShadow + "\"")
-
-		Process.ProcessFileByArgument(
-			"convert \"" + fileCopy + "\" -background none -gravity SouthEast -splice " + str(sepX) + "x" + str(sepY) + "+0+0 \"" + fileShadow + "\" -compose Dst_Over -composite \"" + fileCopy + "\" ")
-
-		pb = gtk.gdk.pixbuf_new_from_file( fileCopy )
-
-		if radBgSolid.get_active() == True:
-			bg = " gradient:" + colorBg + "-" + colorBg
-
-		if radBgGradient.get_active() == True:
-			bg = " gradient:" + colorBg1 + "-" + colorBg2
-
-		Process.ProcessFileByArgument(
-			"convert -size " + str(pb.get_width()) + "x" + str(pb.get_height()) + bg + " -draw \"image Over 0,0 "+str(pb.get_width())+","+str(pb.get_height())+" '" + fileCopy + "'\" \"" + archivo + "\"")
-
-		Process.ProcessFileByArgument("rm \""+fileCopy+"\"")
-		Process.ProcessFileByArgument("rm \""+fileShadow+"\"")
-
-def ClickCancelar(widget):
-	gtk.main_quit()
-
-
-def ClickColor(widget, data):
-	global colorBg
-	global colorBg1
-	global colorBg2
-
-	colorseldlg = gtk.ColorSelectionDialog("Seleccionar color")
-
-	if data == "__bg__":
-		colorseldlg.colorsel.set_current_color(gtk.gdk.color_parse(colorBg))
-	
-	if data == "__bg1__":
-		colorseldlg.colorsel.set_current_color(gtk.gdk.color_parse(colorBg1))
-
-	response = colorseldlg.run()
-
-	if response == gtk.RESPONSE_OK:
-		if data == "__bg__":
-			colorBg = gtk.color_selection_palette_to_string([colorseldlg.colorsel.get_current_color()]) 
-			btnColor.modify_bg(gtk.STATE_NORMAL, colorseldlg.colorsel.get_current_color())
-		if data == "__bg1__":
-			colorBg1 = gtk.color_selection_palette_to_string([colorseldlg.colorsel.get_current_color()]) 
-			btnColorBg1.modify_bg(gtk.STATE_NORMAL, colorseldlg.colorsel.get_current_color())
-
-	colorseldlg.destroy()
-
-def ToggledBg(widget, data):
-	btnColor.set_sensitive(radBgSolid.get_active())
-	btnColorBg1.set_sensitive(radBgGradient.get_active())
-	btnColorBg2.set_sensitive(radBgGradient.get_active())
-
-
-if Process.verifyCommands("convert%ImageMagick")==False:
-	sys.exit()
-	
-	
-w = gtk.Window(gtk.WINDOW_TOPLEVEL)
-w.set_title("Agregar sombra")
-w.set_border_width(20)
-
-w.connect("destroy", gtk.mainquit) 
-#l = gtk.Label(os.environ['NAUTILUS_SCRIPT_SELECTED_FILE_PATHS'])
-
-table = gtk.Table(3, 2, False)
-
-table.set_row_spacings(5)
-table.set_col_spacings(5)
-
-lAncho = gtk.Label("Desenfoque:")
-table.attach(lAncho, 0, 1, 0, 1)
-
-adjTam = gtk.Adjustment(1.0, 1.0, 10.0, 1.0, 5.0, 0.0)
-spinTam = gtk.SpinButton(adjTam, 0, 0)
-spinTam.set_value(5)
-table.attach(spinTam, 1, 2, 0, 1)
-
-lSepX = gtk.Label("Separacion X:")
-table.attach(lSepX, 0, 1, 1, 2)
-
-adjSepX = gtk.Adjustment(1.0, 1.0, 50.0, 1.0, 5.0, 0.0)
-spinSepX = gtk.SpinButton(adjSepX, 0, 0)
-spinSepX.set_value(8)
-table.attach(spinSepX, 1, 2, 1, 2)
-
-lSepY = gtk.Label("Separacion Y:")
-table.attach(lSepY, 0, 1, 2, 3)
-
-adjSepY = gtk.Adjustment(1.0, 1.0, 50.0, 1.0, 5.0, 0.0)
-spinSepY = gtk.SpinButton(adjSepY, 0, 0)
-spinSepY.set_value(8)
-table.attach(spinSepY, 1, 2, 2, 3)
-
-
-radBgSolid = gtk.RadioButton(None, "Fondo con color sólido")
-radBgSolid.set_active(True)
-radBgSolid.connect("toggled", ToggledBg, "rad2")
-table.attach(radBgSolid, 1, 2, 3, 4)
-
-aligButtonColor = gtk.Alignment(1.0, 0.0)
-
-btnColor = gtk.Button()
-
-btnColor.set_size_request(25,25)
-
-btnColor.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(colorBg))
-
-btnColor.set_sensitive(True)
-
-btnColor.connect("clicked", ClickColor, "__bg__")
-
-aligButtonColor.add(btnColor)
-
-table.attach(aligButtonColor, 0, 1, 3, 4)
-
-radBgGradient = gtk.RadioButton(radBgSolid, "Fondo con color gradiente")
-radBgGradient.connect("toggled", ToggledBg, "rad3")
-table.attach(radBgGradient, 1, 2, 4, 5)
-
-
-boxButtonsColorBg = gtk.HBox(True, 4)
-
-aligButtonColorBg = gtk.Alignment(1.0, 0.0)
-
-btnColorBg1 = gtk.Button()
-
-btnColorBg1.set_size_request(25,25)
-
-btnColorBg1.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(colorBg1))
-
-btnColorBg1.set_sensitive(False)
-
-btnColorBg1.connect("clicked", ClickColor, "__bg1__")
-
-boxButtonsColorBg.pack_start(btnColorBg1, False, False, 0)
-
-btnColorBg2 = gtk.Button()
-
-btnColorBg2.set_size_request(25,25)
-
-btnColorBg2.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(colorBg2))
-
-btnColorBg2.set_sensitive(False)
-
-btnColorBg2.connect("clicked", ClickColor, "__bg2__")
-
-boxButtonsColorBg.pack_start(btnColorBg2, False, False, 0)
-
-aligButtonColorBg.add(boxButtonsColorBg)
-
-table.attach(aligButtonColorBg, 0, 1, 4, 5)
-
-
-
-
-
-
-
-# botones
-aligBotones = gtk.Alignment(1.0, 0.0)
-boxBotones = gtk.HBox(True, 4)
-
-bAceptar = gtk.Button("Aceptar", gtk.STOCK_OK)
-bAceptar.connect("clicked", ClickAceptar)
-
-boxBotones.pack_start(bAceptar, False, False, 0)
-bCancelar = gtk.Button("Cancelar", gtk.STOCK_CANCEL)
-bCancelar.connect("clicked", ClickCancelar)
-
-boxBotones.pack_start(bCancelar, False, False, 0)
-aligBotones.add(boxBotones)
-table.attach(aligBotones, 1, 2, 5, 6)
-
-w.add(table)
-w.show_all()
-gtk.main()

Imagenes/Conversor de RAW a JPG

-#!/usr/bin/env python
-# -*- coding: latin-1 -*-
-
-# Creado por Pedro Guridi
-
-import gtk
-import os
-import sys
-import string
-
-sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])),".."))
-import Process
-
-
-def alerta (cadena):
-	dialogo = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_INFO, gtk.BUTTONS_CLOSE, cadena)
-	dialogo.run()
-	dialogo.destroy()
-	
-def ProcesarDirectorio(directorio, compress, wb):
-	archivos = os.listdir(directorio)
-	for archivo in archivos:
-		archivo = directorio + "/" + archivo
-		if os.path.isdir(archivo):
-			ProcesarDirectorio(archivo, compress, wb)
-		else:
-			ProcesarImagen(archivo, compress, wb)
-
-def ProcesarImagen(archivo, compress, wb):
-	if Process.getExtension(archivo) == "NEF":			
-		Process.ProcessFileByArgument("ufraw-batch --wb="+ wb +" --out-type=jpeg --compression="+ compress +" --overwrite"+"\""+archivo+"\"")				
-			
-def ClickAceptar(widget):
-	compress = entryCompress.get_text()
-	orFile = ""	
-	if Wb.get_active() == 0:
-		wb = 'camera'
-	else:
-		wb = 'auto'		
-	
-	archivos = os.environ['NAUTILUS_SCRIPT_SELECTED_FILE_PATHS'].split("\n")	
-	for i in archivos:		
-		if i != "":
-			if Process.getExtension(i)=="RAW" or Process.getExtension(i)=="NEF":							
-				pass
-			else:				
-				alerta("Selecciona solo archivos RAW o .NEF")
-				gtk.main_quit()
-				sys.exit()
-
-	for archivo in archivos:
-		if archivo != "":
-			if os.path.isdir(archivo):				
-				ProcesarDirectorio(archivo, compress, wb)
-			else:
-				ProcesarImagen(archivo, compress, wb)
-				
-	gtk.main_quit()
-
-def ClickCancelar(widget):
-	gtk.main_quit()
-
-# PROGRAMA
-
-if Process.verifyCommands("ufraw-batch%Ufraw")==False:
-	sys.exit()
-
-w = gtk.Window(gtk.WINDOW_TOPLEVEL)
-w.set_title("Conversor de RAW a JPG")
-w.set_border_width(20)
-
-w.connect("destroy", gtk.mainquit) 
-
-
-tableMin = gtk.Table(2, 2, False)
-tableMin.set_border_width(10)
-tableMin.set_row_spacings(12)
-tableMin.set_col_spacings(34)
-
-
-lAncho = gtk.Label("Compresion JPG:")
-tableMin.attach(lAncho, 0, 1, 0, 1)
-entryCompress = gtk.Entry()
-entryCompress.set_text('90')
-tableMin.attach(entryCompress, 1, 2, 0, 1)
-
-
-lWb = gtk.Label("Balance de blancos:")
-tableMin.attach(lWb, 0, 1, 1, 2)
-Wb = gtk.combo_box_new_text()
-Wb.append_text('Camera')
-Wb.append_text('Auto')
-Wb.set_active(0)
-tableMin.attach(Wb, 1, 2, 1, 2)
-
-# botones
-aligBotones = gtk.Alignment(1.0, 0.0)
-boxBotones = gtk.HBox(True, 4)
-
-bAceptar = gtk.Button("Aceptar", gtk.STOCK_OK)
-bAceptar.connect("clicked", ClickAceptar)
-boxBotones.pack_start(bAceptar, False, False, 0)
-
-bCancelar = gtk.Button("Cancelar", gtk.STOCK_CANCEL)
-bCancelar.connect("clicked", ClickCancelar)
-boxBotones.pack_start(bCancelar, False, False, 0)
-
-aligBotones.add(boxBotones)
-tableMin.attach(aligBotones, 0, 2, 3, 4)
-
-w.add(tableMin)
-w.show_all()
-gtk.main()

Imagenes/Conversor de imágenes

-#!/usr/bin/env python
-# -*- coding: latin-1 -*-
-
-import gtk
-import os
-import sys
-import string
-
-sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])),".."))
-import Process
-
-def ClickAceptar(widget):
-
-	orFile = ""
-
-	if radOrJPG.get_active() == True:
-		orFile = "jpg"
-	if radOrPNG.get_active() == True:
-		orFile = "png"
-	if radOrBMP.get_active() == True:
-		orFile = "bmp"
-	if radOrGIF.get_active() == True:
-		orFile = "gif"
-
-	destFile = ""
-
-	if radDestJPG.get_active() == True:
-		destFile = "jpg"
-	if radDestPNG.get_active() == True:
-		destFile = "png"
-	if radDestBMP.get_active() == True:
-		destFile = "bmp"
-	if radDestGIF.get_active() == True:
-		destFile = "gif"
-
-	Process.ProcessFiles(
-		"convert $FILE$ $NAME$."+destFile, # comando a ejecutar
-		orFile, # tipo de archivos
-		True, # leer directorios?
-		False, # procesar directorio como un archivo
-		"") # mensaje final
-
-	if cbRm.get_active()==True:
-		Process.ProcessFiles(
-			"rm $FILE$", # comando a ejecutar
-			orFile, # tipo de archivos
-			True, # leer directorios?
-			False, # procesar directorio como un archivo
-			"") # mensaje final
-
-	gtk.main_quit()
-
-def ClickCancelar(widget):
-	gtk.main_quit()
-
-# PROGRAMA
-
-if Process.verifyCommands("convert%ImageMagick")==False:
-	sys.exit()
-
-w = gtk.Window(gtk.WINDOW_TOPLEVEL)
-w.set_title("Conversor de imágenes")
-w.set_border_width(20)
-
-w.connect("destroy", gtk.mainquit) 
-
-# tabla de la miniatura
-
-tableMin = gtk.Table(2, 1, False)
-tableMin.set_border_width(10)
-
-tableMin.set_row_spacings(12)
-tableMin.set_col_spacings(34)
-
-lOr = gtk.Label("Archivo Origen:")
-
-tableMin.attach(lOr, 0, 1, 0, 1)
-
-lDest = gtk.Label("Archivo Destino:")
-
-tableMin.attach(lDest, 1, 2, 0, 1)
-
-
-boxOr = gtk.VBox(True, 4)
-
-radOrJPG = gtk.RadioButton(None, "JPG")
-radOrJPG.set_active(True)
-boxOr.pack_start(radOrJPG, False, False, 0)
-
-radOrPNG= gtk.RadioButton(radOrJPG, "PNG")
-boxOr.pack_start(radOrPNG, False, False, 0)
-
-radOrBMP= gtk.RadioButton(radOrJPG, "BMP")
-boxOr.pack_start(radOrBMP, False, False, 0)
-
-radOrGIF= gtk.RadioButton(radOrJPG, "GIF")
-boxOr.pack_start(radOrGIF, False, False, 0)
-
-tableMin.attach(boxOr, 0, 1, 1, 2)
-
-boxDest = gtk.VBox(True, 4)
-
-radDestJPG = gtk.RadioButton(None, "JPG")
-boxDest.pack_start(radDestJPG, False, False, 0)
-
-radDestPNG= gtk.RadioButton(radDestJPG, "PNG")
-radDestPNG.set_active(True)
-boxDest.pack_start(radDestPNG, False, False, 0)
-
-radDestBMP= gtk.RadioButton(radDestJPG, "BMP")
-boxDest.pack_start(radDestBMP, False, False, 0)
-
-radDestGIF= gtk.RadioButton(radDestJPG, "GIF")
-boxDest.pack_start(radDestGIF, False, False, 0)
-
-tableMin.attach(boxDest, 1, 2, 1, 2)
-
-
-cbRm = gtk.CheckButton("Borrar archivos origen")
-
-tableMin.attach(cbRm, 0, 2, 2, 3)
-
-# botones
-
-aligBotones = gtk.Alignment(1.0, 0.0)
-boxBotones = gtk.HBox(True, 4)
-
-bAceptar = gtk.Button("Aceptar", gtk.STOCK_OK)
-
-bAceptar.connect("clicked", ClickAceptar)
-
-boxBotones.pack_start(bAceptar, False, False, 0)
-
-bCancelar = gtk.Button("Cancelar", gtk.STOCK_CANCEL)
-
-bCancelar.connect("clicked", ClickCancelar)
-
-boxBotones.pack_start(bCancelar, False, False, 0)
-
-aligBotones.add(boxBotones)
-
-tableMin.attach(aligBotones, 0, 2, 3, 4)
-
-w.add(tableMin)
-w.show_all()
-gtk.main()

Imagenes/Convertir a polaroid

-#!/usr/bin/env python
-# -*- coding: latin-1 -*-
-
-import gtk
-import os, sys
-import string
-from random import randrange
-from xml.dom import minidom
-
-sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])),".."))
-import Process
-
-fileXML = ""
-
-colorBg = "#FFFFFF"
-colorBg1 = "#562525"
-colorBg2 = "#784949"
-
-def ClickAccept(widget):
-
-	global fileXML
-	global colorBg
-	global colorBg1
-	global colorBg2
-
-	# recorremos todos los directorios
-	files = os.environ['NAUTILUS_SCRIPT_SELECTED_FILE_PATHS'].split("\n")
-
-	pathDirectories = Process.getCurrentDirectory()
-
-	fileXML = pathDirectories+"/"+".comments_nautilus.xml"
-
-	widthImg = int(spinWidth.get_value())
-
-	filesArray = []
-
-	for f in files:
-		if f != "":
-			if not os.path.isdir(f):
-				if Process.getExtension(f)=="JPG" or Process.getExtension(f)=="PNG":
-					path = Process.getPath(f)
-					fileName = Process.getFile(f)
-					fileNameCopy = Process.getName(fileName) + "_polaroid.png"
-					fileCopy = path + "/" + fileNameCopy
-
-					fileNameShadow = Process.getName(fileName) + "_shadow.png"
-					fileShadow = path + "/" + fileNameShadow
-
-					#filesArray.append(fileCopy)
-					filesArray.append(fileShadow)
-
-					pb = gtk.gdk.pixbuf_new_from_file( f )
-
-					if pb.get_height()<pb.get_width():
-						Process.ProcessFileByArgument(
-							"convert -resize " + str(widthImg) + "x \"" + f + "\" \"" + fileCopy + "\"")
-					else:
-						Process.ProcessFileByArgument(
-							"convert -resize x" + str(widthImg) + " \"" + f + "\" \"" + fileCopy + "\"")
-
-					pb = gtk.gdk.pixbuf_new_from_file( fileCopy )
-
-					# polaroid
-
-					borderPolaroid = widthImg/30
-
-					Process.ProcessFileByArgument(
-						"convert -size " + str(pb.get_width()+(borderPolaroid*2)) + "x" + str(pb.get_height()+(borderPolaroid*6)) + " gradient:#f0f0ff-#f0f0ff -draw \"image Over " + str(borderPolaroid) + "," + str(borderPolaroid) + " "+str(pb.get_width())+","+str(pb.get_height())+" '" + fileCopy + "'\" \"" + fileCopy + "\"")
-
-					# poner comentario
-					if cbComment.get_active() == True:
-						pb = gtk.gdk.pixbuf_new_from_file( fileCopy )
-						data = readPhotoXML(fileName)
-						if data[0]!="":
-							Process.ProcessFileByArgument(
-								"convert -background none -fill transparent -font helvetica -fill black -pointsize " + str(int(pb.get_height()/14)) + " -draw \"text " + str(borderPolaroid) + "," + str(pb.get_height()-(borderPolaroid*2)) +" '" + data[0] + "'\" \"" + fileCopy + "\" \"" + fileCopy + "\"")
-
-
-					pb = gtk.gdk.pixbuf_new_from_file( fileCopy )
-
-					#Process.ProcessFileByArgument(
-					#	"convert -fill transparent -stroke #000000 -strokewidth 1 -draw \"rectangle 0,0 "+str(pb.get_width())+","+str(pb.get_height())+"\" -draw \"rectangle " + str(borderPolaroid) + "," + str(borderPolaroid) + " "+str(widthPhoto)+","+str(heightPhoto)+"\" \"" + fileCopy + "\" \"" + fileCopy + "\"")
-
-					Process.ProcessFileByArgument(
-						"convert -background none -fill transparent -wave " + str(pb.get_width()*0.01) + "x" + str(pb.get_height()*2) + " \"" + fileCopy + "\" \"" + fileCopy + "\"")
-
-					Process.ProcessFileByArgument(
-						"convert -background none -fill transparent -bordercolor transparent -border 10 -background none -rotate " + str(randrange(-10,10)) + " \"" + fileCopy + "\" \"" + fileCopy + "\"")
-
-					# redimensionamos de nuevo con el filo polaroid
-					if pb.get_height()<pb.get_width():
-						Process.ProcessFileByArgument(
-							"convert -resize " + str(widthImg) + "x \"" + fileCopy + "\" \"" + fileCopy + "\"")
-					else:
-						Process.ProcessFileByArgument(
-							"convert -resize x" + str(widthImg) + " \"" + fileCopy + "\" \"" + fileCopy + "\"")
-
-					# ponemos sombra
-					Process.ProcessFileByArgument(
-						"convert \"" + fileCopy + "\"  -channel A  -blur 0x6  -channel RG -fx 0  -channel B -fx .25 \"" + fileShadow + "\"")
-
-					Process.ProcessFileByArgument(
-						"convert \"" + fileCopy + "\" -background none -gravity SouthEast -splice 6x6+0+0 \"" + fileShadow + "\" -compose Dst_Over -composite \"" + fileCopy + "\" ")
-
-					pb = gtk.gdk.pixbuf_new_from_file( fileCopy )
-
-					if radBgSolid.get_active() == True:
-						Process.ProcessFileByArgument(
-							"convert -size " + str(pb.get_width()) + "x" + str(pb.get_height()) + " gradient:" + colorBg + "-" + colorBg + " -draw \"image Over 0,0 "+str(pb.get_width())+","+str(pb.get_height())+" '" + fileCopy + "'\"" + " \"" + fileCopy + "\"")
-
-					if radBgGradient.get_active() == True:
-						Process.ProcessFileByArgument(
-							"convert -size " + str(pb.get_width()) + "x" + str(pb.get_height()) + " gradient:" + colorBg1 + "-" + colorBg2 + " -draw \"image Over 0,0 "+str(pb.get_width())+","+str(pb.get_height())+" '" + fileCopy + "'\"" + " \"" + fileCopy + "\"")
-
-	for f in filesArray:
-		Process.ProcessFileByArgument(
-			"rm \""+f+"\"")
-
-	gtk.main_quit()
-
-def ClickCancel(widget):
-	gtk.main_quit()
-
-
-def readPhotoXML(f):
-	global fileXML
-	if os.path.isfile(fileXML):
-		dom = minidom.parse(fileXML)
-		for node in dom.getElementsByTagName('photo'):
-			if node.attributes["file"].value == f:
-				return [node.attributes["title"].value, node.attributes["comment"].value]
-
-	return ["",""]
-
-def ClickColor(widget, data):
-	global colorBg
-	global colorBg1
-	global colorBg2
-
-	colorseldlg = gtk.ColorSelectionDialog("Seleccionar color")
-
-	if data == "__bg__":
-		colorseldlg.colorsel.set_current_color(gtk.gdk.color_parse(colorBg))
-	
-	if data == "__bg1__":
-		colorseldlg.colorsel.set_current_color(gtk.gdk.color_parse(colorBg1))
-
-	if data == "__bg2__":
-		colorseldlg.colorsel.set_current_color(gtk.gdk.color_parse(colorBg2))
-
-	response = colorseldlg.run()
-
-	if response == gtk.RESPONSE_OK:
-		if data == "__bg__":
-			colorBg = gtk.color_selection_palette_to_string([colorseldlg.colorsel.get_current_color()]) 
-			btnColor.modify_bg(gtk.STATE_NORMAL, colorseldlg.colorsel.get_current_color())
-		if data == "__bg1__":
-			colorBg1 = gtk.color_selection_palette_to_string([colorseldlg.colorsel.get_current_color()]) 
-			btnColorBg1.modify_bg(gtk.STATE_NORMAL, colorseldlg.colorsel.get_current_color())
-		if data == "__bg2__":
-			colorBg2 = gtk.color_selection_palette_to_string([colorseldlg.colorsel.get_current_color()]) 
-			btnColorBg2.modify_bg(gtk.STATE_NORMAL, colorseldlg.colorsel.get_current_color())
-
-	colorseldlg.destroy()
-
-def ToggledBg(widget, data):
-	btnColor.set_sensitive(radBgSolid.get_active())
-	btnColorBg1.set_sensitive(radBgGradient.get_active())
-	btnColorBg2.set_sensitive(radBgGradient.get_active())
-
-# PROGRAMA
-
-if Process.verifyCommands("convert%ImageMagick")==False:
-	sys.exit()
-
-w = gtk.Window(gtk.WINDOW_TOPLEVEL)
-w.set_title("Covertir a polaroid")
-w.set_border_width(20)
-
-w.connect("destroy", gtk.main_quit) 
-
-# tabla de la miniatura
-
-tableMin = gtk.Table(2, 1, False)
-tableMin.set_border_width(10)
-
-tableMin.set_row_spacings(8)
-tableMin.set_col_spacings(8)
-
-aligImg = gtk.Alignment(0.0, 0.0)
-lImg = gtk.Label()
-lImg.set_markup("<b>Imagen</b>")
-aligImg.add(lImg)
-
-tableMin.attach(aligImg, 0, 2, 0, 1)
-
-lWidth = gtk.Label("Ancho:")
-
-tableMin.attach(lWidth, 0, 1, 1, 2)
-
-adjWidth= gtk.Adjustment(1.0, 1.0, 1024.0, 1.0, 5.0, 0.0)
-spinWidth = gtk.SpinButton(adjWidth, 0, 0)
-spinWidth.set_value(800)
-
-tableMin.attach(spinWidth, 1, 2, 1, 2)
-
-cbComment = gtk.CheckButton("Poner títulos de los comentarios a las fotos")
-
-cbComment.set_active(True);
-
-tableMin.attach(cbComment, 1, 2, 2, 3)
-
-aligBg = gtk.Alignment(0.0, 0.0)
-lBg = gtk.Label()
-lBg.set_markup("<b>Fondo</b>")
-aligBg.add(lBg)
-
-tableMin.attach(aligBg, 0, 2, 3, 4)
-
-# color fondo
-
-radBgTransparent = gtk.RadioButton(None, "Fondo transparente")
-radBgTransparent.set_active(True)
-radBgTransparent.connect("toggled", ToggledBg, "rad1")
-tableMin.attach(radBgTransparent, 1, 2, 4, 5)
-
-radBgSolid = gtk.RadioButton(radBgTransparent, "Fondo con color sólido")
-radBgSolid.connect("toggled", ToggledBg, "rad2")
-tableMin.attach(radBgSolid, 1, 2, 5, 6)
-
-aligButtonColor = gtk.Alignment(1.0, 0.0)
-
-btnColor = gtk.Button()
-
-btnColor.set_size_request(25,25)
-
-btnColor.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(colorBg))
-
-btnColor.set_sensitive(False)
-
-btnColor.connect("clicked", ClickColor, "__bg__")
-
-aligButtonColor.add(btnColor)
-
-tableMin.attach(aligButtonColor, 0, 1, 5, 6)
-
-radBgGradient = gtk.RadioButton(radBgTransparent, "Fondo con color gradiente")
-radBgGradient.connect("toggled", ToggledBg, "rad3")
-tableMin.attach(radBgGradient, 1, 2, 6, 7)
-
-
-boxButtonsColorBg = gtk.HBox(True, 4)
-
-aligButtonColorBg = gtk.Alignment(1.0, 0.0)
-
-btnColorBg1 = gtk.Button()
-
-btnColorBg1.set_size_request(25,25)
-
-btnColorBg1.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(colorBg1))
-
-btnColorBg1.set_sensitive(False)
-
-btnColorBg1.connect("clicked", ClickColor, "__bg1__")
-
-boxButtonsColorBg.pack_start(btnColorBg1, False, False, 0)
-
-btnColorBg2 = gtk.Button()
-
-btnColorBg2.set_size_request(25,25)
-
-btnColorBg2.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(colorBg2))
-
-btnColorBg2.set_sensitive(False)
-
-btnColorBg2.connect("clicked", ClickColor, "__bg2__")
-
-boxButtonsColorBg.pack_start(btnColorBg2, False, False, 0)
-
-aligButtonColorBg.add(boxButtonsColorBg)
-
-tableMin.attach(aligButtonColorBg, 0, 1, 6, 7)
-
-
-# botones
-
-aligButtons = gtk.Alignment(1.0, 0.0)
-boxButtons = gtk.HBox(True, 4)
-
-bCancel = gtk.Button("Cancelar", gtk.STOCK_CANCEL)
-
-bCancel.connect("clicked", ClickCancel)
-
-boxButtons.pack_start(bCancel, False, False, 0)
-
-bAccept = gtk.Button("Aceptar", gtk.STOCK_OK)
-
-bAccept.connect("clicked", ClickAccept)
-
-boxButtons.pack_start(bAccept, False, False, 0)
-
-aligButtons.add(boxButtons)
-tableMin.attach(aligButtons, 1, 2, 7, 8)
-
-w.add(tableMin)
-w.show_all()
-gtk.main()

Imagenes/Crear foto collage

-#!/usr/bin/env python
-# -*- coding: latin-1 -*-
-
-import gtk
-import os, sys
-import string
-from random import randrange
-from xml.dom import minidom
-
-sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])),".."))
-import Process
-
-fileXML = ""
-
-colorBg = "#FFFFFF"
-colorBg1 = "#562525"
-colorBg2 = "#784949"
-
-def ClickAccept(widget):
-	global colorBg
-	global colorBg1
-	global colorBg2
-	global fileXML
-
-	# recorremos todos los directorios
-	files = os.environ['NAUTILUS_SCRIPT_SELECTED_FILE_PATHS'].split("\n")
-
-	pathDirectories = Process.getCurrentDirectory()
-
-	fileXML = pathDirectories+"/"+".comments_nautilus.xml"
-
-	columns = int(spinCol.get_value())
-	rows = int(spinRow.get_value())
-	#if nPhotos%columns!=0:
-	#	rows = rows + 1
-
-	#widthImg = int(spinWidth.get_value()) / columns
-
-
-
-	# copiar archivos
-
-	strDraw = ""
-
-	filesArray = []
-
-	for f in files:
-		if f != "":
-			if not os.path.isdir(f):
-				if Process.getExtension(f)=="JPG" or Process.getExtension(f)=="PNG":
-
-					pb = gtk.gdk.pixbuf_new_from_file( f )
-					photo_collage = Process.getName(f) + "_collage.png"
-
-					despX = int(pb.get_width())/4
-					despY = int(pb.get_height())/4
-
-					widthTotal = int(pb.get_width()) + despX
-					heightTotal = int(pb.get_height()) + despY
-
-					# dividimos la foto
-					Process.ProcessFileByArgument("mkdir out-photo-collage")
-
-					widthChunck = int(pb.get_width()) / columns
-					heightChunck = int(pb.get_height()) / rows
-
-					#border = 0#-(widthChunck/5)
-
-					for x in range(1,columns+1):
-						for y in range(1,rows+1):
-							path = Process.getPath(f) + "/out-photo-collage"
-							fileName = "out-photo-collage/img-" + str(x) + "-" + str(y) + ".jpg"
-							Process.ProcessFileByArgument("convert -crop " + str(widthChunck) + "x" + str(heightChunck) + "+" + str(int((x-1)*widthChunck)) + "+" + str(int((y-1)*heightChunck)) + " \"" + f + "\" \"" + fileName + "\"")
-
-
-							fileNameCopy = Process.getName(fileName) + "_copy.png"
-							fileCopy = path + "/" + fileNameCopy
-
-							fileNameShadow = Process.getName(fileName) + "_shadow.png"
-							fileShadow = path + "/" + fileNameShadow
-								
-							# creamos archivo png de copia
-							Process.ProcessFileByArgument(
-								"convert \"" + fileName + "\" \"" + fileCopy+ "\"")
-
-							borderPolaroid = widthChunck/40
-
-							pb = gtk.gdk.pixbuf_new_from_file( fileCopy )
-
-							Process.ProcessFileByArgument(
-								"convert -size " + str(pb.get_width()+(borderPolaroid*2)) + "x" + str(pb.get_height()+(borderPolaroid*2)) + " gradient:#f0f0ff-#f0f0ff -draw \"image Over " + str(borderPolaroid) + "," + str(borderPolaroid) + " "+str(pb.get_width())+","+str(pb.get_height())+" '" + fileCopy + "'\" \"" + fileCopy + "\"")
-
-							Process.ProcessFileByArgument(
-								"convert -background none -fill transparent -bordercolor transparent -border 10 -background none -rotate " + str(randrange(-2,2)) + " \"" + fileCopy + "\" \"" + fileCopy + "\"")
-
-							# ponemos sombra
-							if cbShadow.get_active():
-								Process.ProcessFileByArgument(
-									"convert \"" + fileCopy + "\"  -channel A  -blur 0x2  -channel RG -fx 0  -channel B -fx .25 \"" + fileShadow + "\"")
-
-
-								Process.ProcessFileByArgument(
-									"convert \"" + fileCopy + "\" -background none -gravity SouthEast -splice 4x4+0+0 \"" + fileShadow + "\" -compose Dst_Over -composite \"" + fileCopy + "\" ")
-
-							pb = gtk.gdk.pixbuf_new_from_file( fileCopy )
-
-							supH = (despX/4)+(x-1)*widthChunck + ((x-1)*(widthChunck/15))
-							supV = (despY/4)+(y-1)*heightChunck + ((y-1)*(heightChunck/15))
-
-							strDraw = strDraw + " -draw \"image Over "+ str(supH) +","+ str(supV) +" "+str(pb.get_width())+","+str(pb.get_height())+" '" + fileCopy + "'\""
-
-					# mosaico
-					bg = ""
-					if radBgTransparent.get_active() == True:
-						bg = " gradient: -channel A -fx 0 "
-
-					if radBgSolid.get_active() == True:
-						bg = " gradient:" + colorBg + "-" + colorBg
-
-					if radBgGradient.get_active() == True:
-						bg = " gradient:" + colorBg1 + "-" + colorBg2
-
-					if radBgImagen.get_active() == True:
-						fileBg = "out-photo-collage/" + Process.getName(f) + "_bg.png"
-						Process.ProcessFileByArgument(
-							"convert -negate -negate -negate -resize " + str(widthTotal) + "x" + str(heightTotal) + " " + f + " " + fileBg)
-						pb = gtk.gdk.pixbuf_new_from_file( fileBg )
-						bg = " gradient: -channel A -fx 0 -draw \"image Over 0,0 "+str(pb.get_width()) +","+str(pb.get_height())+" '" + fileBg + "'\""
-
-					if radBgImagenColorize.get_active() == True:
-						fileBg = "out-photo-collage/" + Process.getName(f) + "_bg.png"
-						Process.ProcessFileByArgument(
-							"convert -modulate 70,50 -resize " + str(widthTotal) + "x" + str(heightTotal) + " " + f + " " + fileBg)
-						pb = gtk.gdk.pixbuf_new_from_file( fileBg )
-						bg = " gradient: -channel A -fx 0 -draw \"image Over 0,0 "+str(pb.get_width()) +","+str(pb.get_height())+" '" + fileBg + "'\""
-
-					if radBgImagenEmboss.get_active() == True:
-						fileBg = "out-photo-collage/" + Process.getName(f) + "_bg.png"
-						Process.ProcessFileByArgument(
-							"convert -modulate 130,70 -resize " + str(widthTotal) + "x" + str(heightTotal) + " " + f + " " + fileBg)
-						pb = gtk.gdk.pixbuf_new_from_file( fileBg )
-						bg = " gradient:#ffffff-#ffffff -draw \"fill-opacity 0.5 image Over 0,0 "+str(pb.get_width()) +","+str(pb.get_height())+" '" + fileBg + "'\""
-
-					if radBgImagenPaint.get_active() == True:
-						fileBg = "out-photo-collage/" + Process.getName(f) + "_bg.png"
-						Process.ProcessFileByArgument(
-							"convert -modulate 130,100 -paint 4 -resize " + str(widthTotal) + "x" + str(heightTotal) + " " + f + " " + fileBg)
-						pb = gtk.gdk.pixbuf_new_from_file( fileBg )
-						bg = " gradient: -channel A -fx 0 -draw \"image Over 0,0 "+str(pb.get_width()) +","+str(pb.get_height())+" '" + fileBg + "'\""
-
-
-					# finalizar
-
-					Process.ProcessFileByArgument(
-						"convert -background none -fill transparent -size " + str(widthTotal) + "x" + str(heightTotal) + bg + strDraw + " \"" + pathDirectories + "/" + photo_collage + "\"")
-
-					# borramos temporales
-
-					Process.ProcessFileByArgument("rm -r \"out-photo-collage\"")
-
-	gtk.main_quit()
-
-def ClickCancel(widget):
-	gtk.main_quit()
-
-def readPhotoXML(f):
-	global fileXML
-	if os.path.isfile(fileXML):
-		dom = minidom.parse(fileXML)
-		for node in dom.getElementsByTagName('photo'):
-			if node.attributes["file"].value == f:
-				return [node.attributes["title"].value, node.attributes["comment"].value]
-
-	return ["",""]
-
-def ClickColor(widget, data):
-	global colorBg
-	global colorBg1
-	global colorBg2
-
-	colorseldlg = gtk.ColorSelectionDialog("Seleccionar color")
-
-	if data == "__bg__":
-		colorseldlg.colorsel.set_current_color(gtk.gdk.color_parse(colorBg))
-	
-	if data == "__bg1__":
-		colorseldlg.colorsel.set_current_color(gtk.gdk.color_parse(colorBg1))
-
-	if data == "__bg2__":
-		colorseldlg.colorsel.set_current_color(gtk.gdk.color_parse(colorBg2))
-
-	response = colorseldlg.run()
-
-	if response == gtk.RESPONSE_OK:
-		if data == "__bg__":
-			colorBg = gtk.color_selection_palette_to_string([colorseldlg.colorsel.get_current_color()]) 
-			btnColor.modify_bg(gtk.STATE_NORMAL, colorseldlg.colorsel.get_current_color())
-		if data == "__bg1__":
-			colorBg1 = gtk.color_selection_palette_to_string([colorseldlg.colorsel.get_current_color()]) 
-			btnColorBg1.modify_bg(gtk.STATE_NORMAL, colorseldlg.colorsel.get_current_color())
-		if data == "__bg2__":
-			colorBg2 = gtk.color_selection_palette_to_string([colorseldlg.colorsel.get_current_color()]) 
-			btnColorBg2.modify_bg(gtk.STATE_NORMAL, colorseldlg.colorsel.get_current_color())
-
-	colorseldlg.destroy()
-
-def ToggledBg(widget, data):
-	btnColor.set_sensitive(radBgSolid.get_active())
-	btnColorBg1.set_sensitive(radBgGradient.get_active())
-	btnColorBg2.set_sensitive(radBgGradient.get_active())
-
-# PROGRAMA
-
-if Process.verifyCommands("convert%ImageMagick")==False:
-	sys.exit()
-
-w = gtk.Window(gtk.WINDOW_TOPLEVEL)
-w.set_title("Crear foto collage")
-w.set_border_width(20)
-
-w.connect("destroy", gtk.mainquit) 
-
-# tabla de la miniatura
-
-tableMin = gtk.Table(2, 1, False)
-tableMin.set_border_width(10)
-
-tableMin.set_row_spacings(8)
-tableMin.set_col_spacings(8)
-
-aligImg = gtk.Alignment(0.0, 0.0)
-lImg = gtk.Label()
-lImg.set_markup("<b>Imagen</b>")
-aligImg.add(lImg)
-
-tableMin.attach(aligImg, 0, 2, 0, 1)
-
-lCol = gtk.Label("Columnas:")
-
-tableMin.attach(lCol, 0, 1, 1, 2)
-
-adjCol = gtk.Adjustment(1.0, 1.0, 20.0, 1.0, 5.0, 0.0)
-spinCol = gtk.SpinButton(adjCol, 0, 0)
-spinCol.set_value(5)
-
-tableMin.attach(spinCol, 1, 2, 1, 2)
-
-lRow = gtk.Label("Filas:")
-
-tableMin.attach(lRow, 0, 1, 2, 3)
-
-adjRow= gtk.Adjustment(1.0, 1.0, 20.0, 1.0, 5.0, 0.0)
-spinRow = gtk.SpinButton(adjRow, 0, 0)
-spinRow.set_value(5)
-
-tableMin.attach(spinRow, 1, 2, 2, 3)
-
-cbShadow = gtk.CheckButton("Poner sombras a las divisiones")
-
-cbShadow.set_active(True);
-
-tableMin.attach(cbShadow, 1, 2, 3, 4)
-
-
-aligBg = gtk.Alignment(0.0, 0.0)
-lBg = gtk.Label()
-lBg.set_markup("<b>Fondo</b>")
-aligBg.add(lBg)
-
-tableMin.attach(aligBg, 0, 2, 4, 5)
-
-# color fondo
-
-radBgTransparent = gtk.RadioButton(None, "Fondo transparente")
-radBgTransparent.set_active(True)
-radBgTransparent.connect("toggled", ToggledBg, "rad1")
-tableMin.attach(radBgTransparent, 1, 2, 5, 6)
-
-radBgImagen = gtk.RadioButton(radBgTransparent, "Fondo con imagen en negativo")
-radBgImagen.connect("toggled", ToggledBg, "rad4")
-tableMin.attach(radBgImagen, 1, 2, 6, 7)
-
-radBgImagenColorize = gtk.RadioButton(radBgTransparent, "Fondo con imagen oscura")
-radBgImagenColorize.connect("toggled", ToggledBg, "rad5")
-tableMin.attach(radBgImagenColorize, 1, 2, 7, 8)
-
-radBgImagenEmboss = gtk.RadioButton(radBgTransparent, "Fondo con imagen aclarada")
-radBgImagenEmboss.connect("toggled", ToggledBg, "rad6")
-tableMin.attach(radBgImagenEmboss, 1, 2, 8, 9)
-
-radBgImagenPaint = gtk.RadioButton(radBgTransparent, "Fondo con imagen pintada")
-radBgImagenPaint.connect("toggled", ToggledBg, "rad7")
-tableMin.attach(radBgImagenPaint, 1, 2, 9, 10)
-
-radBgSolid = gtk.RadioButton(radBgTransparent, "Fondo con color sólido")
-radBgSolid.connect("toggled", ToggledBg, "rad2")
-tableMin.attach(radBgSolid, 1, 2, 10, 11)
-
-aligButtonColor = gtk.Alignment(1.0, 0.0)
-
-btnColor = gtk.Button()
-
-btnColor.set_size_request(25,25)
-
-btnColor.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(colorBg))
-
-btnColor.set_sensitive(False)
-
-btnColor.connect("clicked", ClickColor, "__bg__")
-
-aligButtonColor.add(btnColor)
-
-tableMin.attach(aligButtonColor, 0, 1, 10, 11)
-
-radBgGradient = gtk.RadioButton(radBgTransparent, "Fondo con color gradiente")
-radBgGradient.connect("toggled", ToggledBg, "rad3")
-tableMin.attach(radBgGradient, 1, 2, 11, 12)
-
-
-boxButtonsColorBg = gtk.HBox(True, 4)
-
-aligButtonColorBg = gtk.Alignment(1.0, 0.0)
-
-btnColorBg1 = gtk.Button()
-
-btnColorBg1.set_size_request(25,25)
-
-btnColorBg1.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(colorBg1))
-
-btnColorBg1.set_sensitive(False)
-
-btnColorBg1.connect("clicked", ClickColor, "__bg1__")
-
-boxButtonsColorBg.pack_start(btnColorBg1, False, False, 0)
-
-btnColorBg2 = gtk.Button()
-
-btnColorBg2.set_size_request(25,25)
-
-btnColorBg2.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(colorBg2))
-
-btnColorBg2.set_sensitive(False)
-
-btnColorBg2.connect("clicked", ClickColor, "__bg2__")
-
-boxButtonsColorBg.pack_start(btnColorBg2, False, False, 0)
-
-aligButtonColorBg.add(boxButtonsColorBg)
-
-tableMin.attach(aligButtonColorBg, 0, 1, 11, 12)
-
-
-# botones
-
-aligButtons = gtk.Alignment(1.0, 0.0)
-boxButtons = gtk.HBox(True, 4)
-
-bCancel = gtk.Button("Cancelar", gtk.STOCK_CANCEL)
-
-bCancel.connect("clicked", ClickCancel)
-
-boxButtons.pack_start(bCancel, False, False, 0)
-
-bAccept = gtk.Button("Aceptar", gtk.STOCK_OK)
-
-bAccept.connect("clicked", ClickAccept)
-
-boxButtons.pack_start(bAccept, False, False, 0)
-
-aligButtons.add(boxButtons)
-tableMin.attach(aligButtons, 1, 2, 12, 13)
-
-w.add(tableMin)
-w.show_all()
-gtk.main()

Imagenes/Crear miniaturas

-#!/usr/bin/env python
-# -*- coding: latin-1 -*-
-
-import gtk
-import os, sys
-import string
-
-sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])),".."))
-import Process
-
-# VARIABLES POR DEFECTO
-
-tamImg = 800
-tamMin = 150
-nombreMin = "p"
-
-def alerta (cadena):
-	dialogo = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_INFO, gtk.BUTTONS_CLOSE, cadena)
-	dialogo.run()
-	dialogo.destroy()
-
-def ClickAceptar(widget):
-	archivos = os.environ['NAUTILUS_SCRIPT_SELECTED_FILE_PATHS'].split("\n")
-	for archivo in archivos:
-		if archivo != "":
-			if os.path.isdir(archivo):
-				ProcesarDirectorio(archivo)
-			else:
-				ProcesarImagen(archivo)
-
-	alerta("El proceso ha finalizado satisfactoriamente")
-	gtk.main_quit()
-
-def ProcesarDirectorio(directorio):
-	archivos = os.listdir(directorio)
-	for archivo in archivos:
-		archivo = directorio + "/" + archivo
-		if os.path.isdir(archivo):
-			ProcesarDirectorio(archivo)
-		else:
-			ProcesarImagen(archivo)
-
-def ProcesarImagen(archivo):
-	program = "convert"
-
-	if getExtension(archivo) == "JPG" or getExtension(archivo) == "PNG":
-		image = gtk.gdk.pixbuf_new_from_file( archivo )
-		intercambiar = False
-		if cbIntercambiar.get_active() and image.get_height()>image.get_width():
-			intercambiar = True
-
-		# creamos miniatura 
-		geo = ""
-
-		if cbPorcentajeMin.get_active():
-			geo = str(spinTamMin.get_value())+"%"
-		else:
-			if intercambiar:
-				if rbTamAncho.get_active():
-					geo = "x"+str(spinTamMin.get_value())
-				else:
-					geo = str(spinTamMin.get_value())+"x"
-			else:
-				if rbTamAncho.get_active():
-					geo = str(spinTamMin.get_value())+"x"
-				else:
-					geo = "x"+str(spinTamMin.get_value())
-
-		arguments = ["-resize", geo, archivo, getNombreMiniatura(archivo)]
-
-		os.spawnvp(os.P_NOWAIT, program, (program,) +  tuple(arguments))
-
-
-def getNombreMiniatura(archivo):
-	trozos = archivo.split("/")
-	i = 0
-	miniatura = ""
-	while i<len(trozos)-1:
-		if trozos[i] != "":
-			miniatura = miniatura  + "/" + trozos[i]
-		i = i + 1
-
-	miniatura = miniatura + "/" + entryNombre.get_text() + trozos[i]
-
-	return miniatura
-
-def getExtension(archivo):
-	trozos = archivo.split(".")
-	return string.upper(trozos[len(trozos)-1])
-
-def ClickCancelar(widget):
-	gtk.main_quit()
-
-
-# PROGRAMA
-
-if Process.verifyCommands("convert%ImageMagick")==False:
-	sys.exit()
-
-w = gtk.Window(gtk.WINDOW_TOPLEVEL)
-w.set_title("Redimensionar imágenes")
-w.set_border_width(20)
-
-w.connect("destroy", gtk.mainquit) 
-#l = gtk.Label(os.environ['NAUTILUS_SCRIPT_SELECTED_FILE_PATHS'])
-
-# tabla de la miniatura
-
-tableMin = gtk.Table(3, 3, False)
-tableMin.set_border_width(10)
-
-tableMin.set_row_spacings(8)
-tableMin.set_col_spacings(8)
-
-lTamMin = gtk.Label("Tamaño:")
-
-tableMin.attach(lTamMin, 0, 1, 0, 1)
-
-adjTamMin = gtk.Adjustment(1.0, 1.0, 999999.0, 1.0, 5.0, 0.0)
-spinTamMin = gtk.SpinButton(adjTamMin, 0, 0)
-spinTamMin.set_value(tamMin)
-
-tableMin.attach(spinTamMin, 1, 2, 0, 1)
-
-cbPorcentajeMin = gtk.CheckButton("%")
-tableMin.attach(cbPorcentajeMin, 2, 3, 0, 1)
-
-lAlto = gtk.Label("Proporcional al:")
-
-tableMin.attach(lAlto, 0, 1, 1, 2)
-
-boxTamRadio = gtk.HBox(False, 4)
-boxTamRadio.set_border_width(4)
-boxTamRadio.show()
-
-rbTamAncho = gtk.RadioButton(None, "Ancho")
-rbTamAncho.set_active(True)
-rbTamAncho.show()
-boxTamRadio.pack_start(rbTamAncho, True, True, 0)
-
-rbTamAlto = gtk.RadioButton(rbTamAncho, "Alto")
-rbTamAlto.show()
-boxTamRadio.pack_start(rbTamAlto, True, True, 0)
-
-tableMin.attach(boxTamRadio, 1, 3, 1, 2)
-
-lNombreMin = gtk.Label("Texto al principio:")
-
-tableMin.attach(lNombreMin, 0, 1, 2, 3)
-
-entryNombre = gtk.Entry()
-entryNombre.set_text(nombreMin)
-
-tableMin.attach(entryNombre, 1, 3, 2, 3)
-
-cbIntercambiar = gtk.CheckButton("Intercambiar tamaño en fotos verticales")
-
-cbIntercambiar.set_active(True);
-
-tableMin.attach(cbIntercambiar, 0, 3, 3, 4)
-
-
-# botones
-
-aligBotones = gtk.Alignment(1.0, 0.0)
-boxBotones = gtk.HBox(True, 4)
-
-bAceptar = gtk.Button("Aceptar", gtk.STOCK_OK)
-
-bAceptar.connect("clicked", ClickAceptar)
-
-boxBotones.pack_start(bAceptar, False, False, 0)
-
-bCancelar = gtk.Button("Cancelar", gtk.STOCK_CANCEL)
-
-bCancelar.connect("clicked", ClickCancelar)
-
-boxBotones.pack_start(bCancelar, False, False, 0)
-
-aligBotones.add(boxBotones)
-
-tableMin.attach(aligBotones, 1, 2, 4, 5)
-
-w.add(tableMin)
-w.show_all()
-gtk.main()

Imagenes/Crear mosaico fotográfico

-#!/usr/bin/env python
-# -*- coding: latin-1 -*-
-
-import gtk
-import os, sys
-import string
-
-sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])),".."))
-import Process
-
-colorBorder = "#FFFFFF"
-
-colorBg = "#FFFFFF"
-colorBg1 = "#562525"
-colorBg2 = "#784949"
-
-def ClickAccept(widget):
-
-	global colorBorder
-	global colorBg
-	global colorBg1
-	global colorBg2
-
-	# recorremos todos los directorios
-	files = os.environ['NAUTILUS_SCRIPT_SELECTED_FILE_PATHS'].split("\n")
-
-	pathDirectories = Process.getCurrentDirectory()
-
-	# numero de fotos
-	nPhotos = 0
-	for f in files:
-		if f != "":
-			if not os.path.isdir(f):
-				if Process.getExtension(f)=="JPG" or Process.getExtension(f)=="PNG":
-					nPhotos = nPhotos + 1
-
-	columns = int(spinCol.get_value())
-	rows = nPhotos/columns
-	if nPhotos%columns!=0:
-		rows = rows + 1
-
-	widthImg = int(spinWidth.get_value()) / columns
-
-	widthTotal = int(spinWidth.get_value()) + ( int(spinBorder.get_value())*(columns+1) )
-
-	heightTotal = widthImg*rows + ( int(spinBorder.get_value())*(rows+1) )
-
-	# copiar archivos
-
-	strDraw = ""
-
-	currentRow = 0
-	currentColumn = 0
-
-	filesArray = []
-
-	for f in files:
-		if f != "":
-			if not os.path.isdir(f):
-				if Process.getExtension(f)=="JPG" or Process.getExtension(f)=="PNG":
-					path = Process.getPath(f)
-					fileName = Process.getFile(f)
-					fileNameCopy = Process.getName(fileName) + "_copy." + Process.getExtension(fileName)
-					fileCopy = path + "/" + fileNameCopy
-
-					filesArray.append(fileCopy)
-
-					pb = gtk.gdk.pixbuf_new_from_file( f )
-					if pb.get_height()<pb.get_width():
-						Process.ProcessFileByArgument(
-							"convert -resize " + str(widthImg) + "x \"" + f + "\" \"" + fileCopy + "\"")
-					else:
-						Process.ProcessFileByArgument(
-							"convert -resize x" + str(widthImg) + " \"" + f + "\" \"" + fileCopy + "\"")
-
-					pb = gtk.gdk.pixbuf_new_from_file( fileCopy )
-
-					if cbBorder.get_active():
-						Process.ProcessFileByArgument(
-							"convert -fill transparent -stroke " + colorBorder + " -strokewidth " + str(int(spinSizeBorder.get_value())) + " -draw \"rectangle 0,0 "+str(pb.get_width())+","+str(pb.get_height())+"\" \"" + fileCopy + "\" \"" + fileCopy + "\"")
-
-					supH = currentColumn*widthImg + ( (widthImg-pb.get_width())/2 ) + ( int(spinBorder.get_value())*(currentColumn+1) )
-					supV = currentRow*widthImg + ( (widthImg-pb.get_height())/2 ) + ( int(spinBorder.get_value())*(currentRow+1) )
-
-					strDraw = strDraw + " -draw \"image Over "+ str(supH) +","+ str(supV) +" "+str(pb.get_width())+","+str(pb.get_height())+" '" + fileCopy + "'\""
-
-
-					currentColumn = currentColumn + 1
-
-					if currentColumn >= columns:
-						currentColumn = 0
-						currentRow = currentRow + 1
-
-	# mosaico
-
-	bg = ""
-	if radBgTransparent.get_active() == True:
-		bg = " gradient: -channel A -fx 0 "
-
-	if radBgSolid.get_active() == True:
-		bg = " gradient:" + colorBg + "-" + colorBg
-
-	if radBgGradient.get_active() == True:
-		bg = " gradient:" + colorBg1 + "-" + colorBg2
-
-	Process.ProcessFileByArgument(
-		"convert -background none -fill transparent -size " + str(widthTotal) + "x" + str(heightTotal) + bg + strDraw + " \"" + pathDirectories + "/salida.png\"")
-
-	# borramos temporales
-
-	for f in filesArray:
-		Process.ProcessFileByArgument(
-			"rm \""+f+"\"")
-
-	gtk.main_quit()
-
-def ClickCancel(widget):
-	gtk.main_quit()
-
-def ClickColor(widget, data):
-	global colorBorder
-	global colorBg
-	global colorBg1
-	global colorBg2
-
-	colorseldlg = gtk.ColorSelectionDialog("Seleccionar color")
-
-	if data == "__border__":
-		colorseldlg.colorsel.set_current_color(gtk.gdk.color_parse(colorBorder))
-
-	if data == "__bg__":
-		colorseldlg.colorsel.set_current_color(gtk.gdk.color_parse(colorBg))
-	
-	if data == "__bg1__":
-		colorseldlg.colorsel.set_current_color(gtk.gdk.color_parse(colorBg1))
-
-	if data == "__bg2__":
-		colorseldlg.colorsel.set_current_color(gtk.gdk.color_parse(colorBg2))
-
-	response = colorseldlg.run()
-
-	if response == gtk.RESPONSE_OK:
-		if data == "__border__":
-			colorBorder = gtk.color_selection_palette_to_string([colorseldlg.colorsel.get_current_color()]) 
-			btnColor.modify_bg(gtk.STATE_NORMAL, colorseldlg.colorsel.get_current_color())
-		if data == "__bg__":
-			colorBg = gtk.color_selection_palette_to_string([colorseldlg.colorsel.get_current_color()]) 
-			btnColor.modify_bg(gtk.STATE_NORMAL, colorseldlg.colorsel.get_current_color())
-		if data == "__bg1__":
-			colorBg1 = gtk.color_selection_palette_to_string([colorseldlg.colorsel.get_current_color()]) 
-			btnColorBg1.modify_bg(gtk.STATE_NORMAL, colorseldlg.colorsel.get_current_color())
-		if data == "__bg2__":
-			colorBg2 = gtk.color_selection_palette_to_string([colorseldlg.colorsel.get_current_color()]) 
-			btnColorBg2.modify_bg(gtk.STATE_NORMAL, colorseldlg.colorsel.get_current_color())
-
-	colorseldlg.destroy()
-
-def ToggledBg(widget, data):
-	btnColor.set_sensitive(radBgSolid.get_active())
-	btnColorBg1.set_sensitive(radBgGradient.get_active())
-	btnColorBg2.set_sensitive(radBgGradient.get_active())
-
-# PROGRAMA
-
-if Process.verifyCommands("convert%ImageMagick")==False:
-	sys.exit()
-
-w = gtk.Window(gtk.WINDOW_TOPLEVEL)
-w.set_title("Crear mosaico fotográfico")
-w.set_border_width(20)
-
-w.connect("destroy", gtk.mainquit) 
-
-# tabla de la miniatura
-
-tableMin = gtk.Table(2, 1, False)
-tableMin.set_border_width(10)
-
-tableMin.set_row_spacings(8)
-tableMin.set_col_spacings(8)
-
-aligImg = gtk.Alignment(0.0, 0.0)
-lImg = gtk.Label()
-lImg.set_markup("<b>Imagen</b>")
-aligImg.add(lImg)
-
-tableMin.attach(aligImg, 0, 2, 0, 1)
-
-lWidth = gtk.Label("Ancho Imagen:")
-
-tableMin.attach(lWidth, 0, 1, 1, 2)
-
-adjWidth= gtk.Adjustment(1.0, 1.0, 1024.0, 1.0, 5.0, 0.0)
-spinWidth = gtk.SpinButton(adjWidth, 0, 0)
-spinWidth.set_value(800)
-
-tableMin.attach(spinWidth, 1, 2, 1, 2)
-
-lBorder = gtk.Label("Distancia:")
-
-tableMin.attach(lBorder, 0, 1, 2, 3)
-
-adjBorder= gtk.Adjustment(1.0, 1.0, 80.0, 1.0, 5.0, 0.0)
-spinBorder = gtk.SpinButton(adjBorder, 0, 0)
-spinBorder.set_value(40)
-
-tableMin.attach(spinBorder, 1, 2, 2, 3)
-
-lCol = gtk.Label("Columnas:")
-
-tableMin.attach(lCol, 0, 1, 3, 4)
-
-adjCol = gtk.Adjustment(1.0, 1.0, 10.0, 1.0, 5.0, 0.0)
-spinCol = gtk.SpinButton(adjCol, 0, 0)
-spinCol.set_value(3)
-
-tableMin.attach(spinCol, 1, 2, 3, 4)
-
-aligBorderImg = gtk.Alignment(0.0, 0.0)
-lBorderImg = gtk.Label()
-lBorderImg.set_markup("<b>Borde de las imágenes</b>")
-aligBorderImg.add(lBorderImg)
-
-tableMin.attach(aligBorderImg, 0, 2, 4, 5)
-
-lSizeBorder = gtk.Label("Tamaño:")
-
-tableMin.attach(lSizeBorder, 0, 1, 5, 6)
-
-adjSizeBorder = gtk.Adjustment(1.0, 1.0, 6.0, 1.0, 5.0, 0.0)
-spinSizeBorder = gtk.SpinButton(adjSizeBorder, 0, 0)
-spinSizeBorder.set_value(2)
-
-tableMin.attach(spinSizeBorder, 1, 2, 5, 6)
-
-lColorBorder = gtk.Label("Color:")
-
-tableMin.attach(lColorBorder, 0, 1, 6, 7)
-
-aligButtonColor = gtk.Alignment(0.0, 0.0)
-
-btnColor = gtk.Button()
-
-btnColor.set_size_request(25,25)
-
-btnColor.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(colorBorder))
-
-btnColor.connect("clicked", ClickColor, "__border__")
-
-aligButtonColor.add(btnColor)
-
-tableMin.attach(aligButtonColor, 1, 2, 6, 7)
-
-cbBorder = gtk.CheckButton("Poner borde a las imágenes")
-cbBorder.set_active(True)
-tableMin.attach(cbBorder, 1, 2, 7, 8)
-
-# fondo
-aligBg = gtk.Alignment(0.0, 0.0)
-lBg = gtk.Label()
-lBg.set_markup("<b>Fondo</b>")
-aligBg.add(lBg)
-
-tableMin.attach(aligBg, 0, 2, 8, 9)
-
-# color fondo
-
-radBgTransparent = gtk.RadioButton(None, "Fondo transparente")
-radBgTransparent.set_active(True)
-radBgTransparent.connect("toggled", ToggledBg, "rad1")
-tableMin.attach(radBgTransparent, 1, 2, 9, 10)
-
-radBgSolid = gtk.RadioButton(radBgTransparent, "Fondo con color sólido")
-radBgSolid.connect("toggled", ToggledBg, "rad2")
-tableMin.attach(radBgSolid, 1, 2, 10, 11)
-
-aligButtonColor = gtk.Alignment(1.0, 0.0)
-
-btnColor = gtk.Button()
-
-btnColor.set_size_request(25,25)
-
-btnColor.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(colorBg))
-
-btnColor.set_sensitive(False)
-
-btnColor.connect("clicked", ClickColor, "__bg__")
-
-aligButtonColor.add(btnColor)
-
-tableMin.attach(aligButtonColor, 0, 1, 10, 11)
-
-radBgGradient = gtk.RadioButton(radBgTransparent, "Fondo con color gradiente")
-radBgGradient.connect("toggled", ToggledBg, "rad3")
-tableMin.attach(radBgGradient, 1, 2, 11, 12)
-
-
-boxButtonsColorBg = gtk.HBox(True, 4)
-
-aligButtonColorBg = gtk.Alignment(1.0, 0.0)
-
-btnColorBg1 = gtk.Button()
-
-btnColorBg1.set_size_request(25,25)
-
-btnColorBg1.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(colorBg1))
-
-btnColorBg1.set_sensitive(False)
-
-btnColorBg1.connect("clicked", ClickColor, "__bg1__")
-
-boxButtonsColorBg.pack_start(btnColorBg1, False, False, 0)
-
-btnColorBg2 = gtk.Button()
-
-btnColorBg2.set_size_request(25,25)
-
-btnColorBg2.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(colorBg2))
-
-btnColorBg2.set_sensitive(False)
-
-btnColorBg2.connect("clicked", ClickColor, "__bg2__")
-
-boxButtonsColorBg.pack_start(btnColorBg2, False, False, 0)
-
-aligButtonColorBg.add(boxButtonsColorBg)
-
-tableMin.attach(aligButtonColorBg, 0, 1, 11, 12)
-
-
-# botones
-
-aligButtons = gtk.Alignment(1.0, 0.0)
-boxButtons = gtk.HBox(True, 4)
-
-bCancel = gtk.Button("Cancelar", gtk.STOCK_CANCEL)
-
-bCancel.connect("clicked", ClickCancel)
-
-boxButtons.pack_start(bCancel, False, False, 0)
-
-bAccept = gtk.Button("Aceptar", gtk.STOCK_OK)
-
-bAccept.connect("clicked", ClickAccept)
-
-boxButtons.pack_start(bAccept, False, False, 0)
-
-aligButtons.add(boxButtons)
-tableMin.attach(aligButtons, 1, 2, 12, 13)
-
-w.add(tableMin)
-w.show_all()
-gtk.main()

Imagenes/Crear mosaico polaroids

-#!/usr/bin/env python
-# -*- coding: latin-1 -*-
-
-import gtk
-import os, sys
-import string
-from random import randrange
-from xml.dom import minidom
-
-sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])),".."))
-import Process
-
-fileXML = ""
-
-colorBg = "#FFFFFF"
-colorBg1 = "#562525"
-colorBg2 = "#784949"
-
-def ClickAccept(widget):
-	global colorBg
-	global colorBg1
-	global colorBg2
-	global fileXML
-
-	# recorremos todos los directorios
-	files = os.environ['NAUTILUS_SCRIPT_SELECTED_FILE_PATHS'].split("\n")
-
-	pathDirectories = Process.getCurrentDirectory()
-
-	fileXML = pathDirectories+"/"+".comments_nautilus.xml"
-
-	# numero de fotos
-	nPhotos = 0
-	for f in files:
-		if f != "":
-			if not os.path.isdir(f):
-				if Process.getExtension(f)=="JPG" or Process.getExtension(f)=="PNG":
-					nPhotos = nPhotos + 1
-
-	
-	columns = int(spinCol.get_value())
-	rows = nPhotos/columns
-	if nPhotos%columns!=0:
-		rows = rows + 1
-
-	widthImg = int(spinWidth.get_value()) / columns
-
-	border = -(widthImg/5)
-
-	widthTotal = int(spinWidth.get_value()) + ( border*(columns-1) )
-
-	heightTotal = widthImg*rows + ( border*(rows-1) )
-
-	# copiar archivos
-
-	strDraw = ""
-
-	currentRow = 0
-	currentColumn = 0
-
-	filesArray = []
-
-	for f in files:
-		if f != "":
-			if not os.path.isdir(f):
-				if Process.getExtension(f)=="JPG" or Process.getExtension(f)=="PNG":
-					path = Process.getPath(f)
-					fileName = Process.getFile(f)
-					fileNameCopy = Process.getName(fileName) + "_copy.png"
-					fileCopy = path + "/" + fileNameCopy
-
-					fileNameShadow = Process.getName(fileName) + "_shadow.png"
-					fileShadow = path + "/" + fileNameShadow
-
-					filesArray.append(fileCopy)
-					filesArray.append(fileShadow)
-
-					pb = gtk.gdk.pixbuf_new_from_file( f )
-					if pb.get_height()<pb.get_width():
-						Process.ProcessFileByArgument(
-							"convert -resize " + str(widthImg) + "x \"" + f + "\" \"" + fileCopy + "\"")
-					else:
-						Process.ProcessFileByArgument(
-							"convert -resize x" + str(widthImg) + " \"" + f + "\" \"" + fileCopy + "\"")
-
-					pb = gtk.gdk.pixbuf_new_from_file( fileCopy )
-
-					# polaroid
-
-					borderPolaroid = widthImg/30
-
-					Process.ProcessFileByArgument(
-						"convert -size " + str(pb.get_width()+(borderPolaroid*2)) + "x" + str(pb.get_height()+(borderPolaroid*6)) + " gradient:#f0f0ff-#f0f0ff -draw \"image Over " + str(borderPolaroid) + "," + str(borderPolaroid) + " "+str(pb.get_width())+","+str(pb.get_height())+" '" + fileCopy + "'\" \"" + fileCopy + "\"")
-
-					# poner comentario
-					if cbComment.get_active() == True:
-						pb = gtk.gdk.pixbuf_new_from_file( fileCopy )
-						data = readPhotoXML(fileName)
-						if data[0]!="":
-							Process.ProcessFileByArgument(
-								"convert -background none -fill transparent -font helvetica -fill black -pointsize " + str(int(pb.get_height()/14)) + " -draw \"text " + str(borderPolaroid) + "," + str(pb.get_height()-(borderPolaroid*2)) +" '" + data[0] + "'\" \"" + fileCopy + "\" \"" + fileCopy + "\"")
-
-					widthPhoto = pb.get_width()+borderPolaroid
-					heightPhoto = pb.get_height()+borderPolaroid
-
-					pb = gtk.gdk.pixbuf_new_from_file( fileCopy )
-
-					#Process.ProcessFileByArgument(
-					#	"convert -fill transparent -stroke #000000 -strokewidth 1 -draw \"rectangle 0,0 "+str(pb.get_width())+","+str(pb.get_height())+"\" -draw \"rectangle " + str(borderPolaroid) + "," + str(borderPolaroid) + " "+str(widthPhoto)+","+str(heightPhoto)+"\" \"" + fileCopy + "\" \"" + fileCopy + "\"")
-
-					Process.ProcessFileByArgument(
-						"convert -background none -fill transparent -wave " + str(pb.get_width()*0.01) + "x" + str(pb.get_height()*2) + " \"" + fileCopy + "\" \"" + fileCopy + "\"")
-
-					Process.ProcessFileByArgument(
-						"convert -background none -fill transparent -bordercolor transparent -border 10 -background none -rotate " + str(randrange(-10,10)) + " \"" + fileCopy + "\" \"" + fileCopy + "\"")
-
-					# redimensionamos de nuevo con el filo polaroid
-					if pb.get_height()<pb.get_width():
-						Process.ProcessFileByArgument(
-							"convert -resize " + str(widthImg) + "x \"" + fileCopy + "\" \"" + fileCopy + "\"")
-					else:
-						Process.ProcessFileByArgument(
-							"convert -resize x" + str(widthImg) + " \"" + fileCopy + "\" \"" + fileCopy + "\"")
-
-					# ponemos sombra
-					Process.ProcessFileByArgument(
-						"convert \"" + fileCopy + "\"  -channel A  -blur 0x6  -channel RG -fx 0  -channel B -fx .25 \"" + fileShadow + "\"")
-
-					Process.ProcessFileByArgument(
-						"convert \"" + fileCopy + "\" -background none -gravity SouthEast -splice 6x6+0+0 \"" + fileShadow + "\" -compose Dst_Over -composite \"" + fileCopy + "\" ")
-
-					pb = gtk.gdk.pixbuf_new_from_file( fileCopy )
-
-					supH = currentColumn*widthImg + ( (widthImg-pb.get_width())/2 ) + ( border*(currentColumn) )
-					supV = currentRow*widthImg + ( (widthImg-pb.get_height())/2 ) + ( border*(currentRow) )
-
-					strDraw = strDraw + " -draw \"image Over "+ str(supH) +","+ str(supV) +" "+str(pb.get_width())+","+str(pb.get_height())+" '" + fileCopy + "'\""
-
-
-					currentColumn = currentColumn + 1
-
-					if currentColumn >= columns:
-						currentColumn = 0
-						currentRow = currentRow + 1
-
-	# mosaico
-	bg = ""
-	if radBgTransparent.get_active() == True:
-		bg = " gradient: -channel A -fx 0 "
-
-	if radBgSolid.get_active() == True:
-		bg = " gradient:" + colorBg + "-" + colorBg
-
-	if radBgGradient.get_active() == True:
-		bg = " gradient:" + colorBg1 + "-" + colorBg2
-
-
-	Process.ProcessFileByArgument(
-		"convert -background none -fill transparent -size " + str(widthTotal) + "x" + str(heightTotal) + bg + strDraw + " \"" + pathDirectories + "/salida.png\"")
-
-	# borramos temporales
-
-	for f in filesArray:
-		Process.ProcessFileByArgument(
-			"rm \""+f+"\"")
-
-	gtk.main_quit()
-
-def ClickCancel(widget):
-	gtk.main_quit()
-
-def readPhotoXML(f):
-	global fileXML
-	if os.path.isfile(fileXML):
-		dom = minidom.parse(fileXML)
-		for node in dom.getElementsByTagName('photo'):
-			if node.attributes["file"].value == f:
-				return [node.attributes["title"].value, node.attributes["comment"].value]
-
-	return ["",""]
-
-def ClickColor(widget, data):
-	global colorBg
-	global colorBg1
-	global colorBg2
-
-	colorseldlg = gtk.ColorSelectionDialog("Seleccionar color")
-
-	if data == "__bg__":
-		colorseldlg.colorsel.set_current_color(gtk.gdk.color_parse(colorBg))
-	
-	if data == "__bg1__":
-		colorseldlg.colorsel.set_current_color(gtk.gdk.color_parse(colorBg1))
-
-	if data == "__bg2__":
-		colorseldlg.colorsel.set_current_color(gtk.gdk.color_parse(colorBg2))
-
-	response = colorseldlg.run()
-
-	if response == gtk.RESPONSE_OK:
-		if data == "__bg__":
-			colorBg = gtk.color_selection_palette_to_string([colorseldlg.colorsel.get_current_color()]) 
-			btnColor.modify_bg(gtk.STATE_NORMAL, colorseldlg.colorsel.get_current_color())
-		if data == "__bg1__":
-			colorBg1 = gtk.color_selection_palette_to_string([colorseldlg.colorsel.get_current_color()]) 
-			btnColorBg1.modify_bg(gtk.STATE_NORMAL, colorseldlg.colorsel.get_current_color())
-		if data == "__bg2__":
-			colorBg2 = gtk.color_selection_palette_to_string([colorseldlg.colorsel.get_current_color()]) 
-			btnColorBg2.modify_bg(gtk.STATE_NORMAL, colorseldlg.colorsel.get_current_color())
-
-	colorseldlg.destroy()
-
-def ToggledBg(widget, data):
-	btnColor.set_sensitive(radBgSolid.get_active())
-	btnColorBg1.set_sensitive(radBgGradient.get_active())
-	btnColorBg2.set_sensitive(radBgGradient.get_active())
-
-# PROGRAMA
-
-if Process.verifyCommands("convert%ImageMagick")==False:
-	sys.exit()
-
-w = gtk.Window(gtk.WINDOW_TOPLEVEL)
-w.set_title("Crear mosaico de polaroids")
-w.set_border_width(20)
-
-w.connect("destroy", gtk.mainquit) 
-
-# tabla de la miniatura
-
-tableMin = gtk.Table(2, 1, False)
-tableMin.set_border_width(10)
-
-tableMin.set_row_spacings(8)
-tableMin.set_col_spacings(8)
-
-aligImg = gtk.Alignment(0.0, 0.0)
-lImg = gtk.Label()
-lImg.set_markup("<b>Imagen</b>")
-aligImg.add(lImg)
-
-tableMin.attach(aligImg, 0, 2, 0, 1)
-
-lWidth = gtk.Label("Ancho:")
-
-tableMin.attach(lWidth, 0, 1, 1, 2)
-
-adjWidth= gtk.Adjustment(1.0, 1.0, 1024.0, 1.0, 5.0, 0.0)
-spinWidth = gtk.SpinButton(adjWidth, 0, 0)
-spinWidth.set_value(800)
-
-tableMin.attach(spinWidth, 1, 2, 1, 2)
-
-lCol = gtk.Label("Columnas:")
-
-tableMin.attach(lCol, 0, 1, 2, 3)
-
-adjCol = gtk.Adjustment(1.0, 1.0, 10.0, 1.0, 5.0, 0.0)
-spinCol = gtk.SpinButton(adjCol, 0, 0)
-spinCol.set_value(3)
-
-tableMin.attach(spinCol, 1, 2, 2, 3)
-
-cbComment = gtk.CheckButton("Poner títulos de los comentarios a las fotos")
-
-cbComment.set_active(True);
-
-tableMin.attach(cbComment, 1, 2, 3, 4)
-
-
-aligBg = gtk.Alignment(0.0, 0.0)
-lBg = gtk.Label()
-lBg.set_markup("<b>Fondo</b>")
-aligBg.add(lBg)
-
-tableMin.attach(aligBg, 0, 2, 4, 5)
-
-# color fondo
-
-radBgTransparent = gtk.RadioButton(None, "Fondo transparente")
-radBgTransparent.set_active(True)
-radBgTransparent.connect("toggled", ToggledBg, "rad1")
-tableMin.attach(radBgTransparent, 1, 2, 5, 6)
-
-radBgSolid = gtk.RadioButton(radBgTransparent, "Fondo con color sólido")
-radBgSolid.connect("toggled", ToggledBg, "rad2")
-tableMin.attach(radBgSolid, 1, 2, 6, 7)
-
-aligButtonColor = gtk.Alignment(1.0, 0.0)
-
-btnColor = gtk.Button()
-
-btnColor.set_size_request(25,25)
-
-btnColor.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(colorBg))
-
-btnColor.set_sensitive(False)
-
-btnColor.connect("clicked", ClickColor, "__bg__")
-
-aligButtonColor.add(btnColor)
-
-tableMin.attach(aligButtonColor, 0, 1, 6, 7)
-
-radBgGradient = gtk.RadioButton(radBgTransparent, "Fondo con color gradiente")
-radBgGradient.connect("toggled", ToggledBg, "rad3")
-tableMin.attach(radBgGradient, 1, 2, 7, 8)
-
-