I wrote a script in Python which I'm familiar with,
If somebody can help me translate it to CS6 JavaScript i'll appreciate it!
Thanks
Stav
import os, sys
from PIL import Image, ImageTk, ImageFilter, ImageOps
def canvas (path):
dic = {}
for file in os.listdir( path ):
if dic.get(file[:6]) == None:
dic[file[:6]] = [file]
else:
dic[file[:6]]+=[file]
for key in dic:
dim = None
for pic in dic[key]: # find biggest dimmention
im = Image.open(path+pic)
if dim < max(im.size):
dim = max(im.size)
for pic in dic[key]: # open square canvas
im = Image.open(path+pic,'r')
w,h = im.size
background = Image.new('L', (dim,dim), "white")
background.paste(im,((dim-w)/2,(dim-h)/2))
background.save(path+pic)