text: I'm trying to write a script for CS6 to process photos for a website. I have some experience in programing in Python and I looked at some Java scripts for CS6 and can understand the commands and logics.
  I thought about this idea for a code.
  I have a folder of the pictures, cleaned and after editing process, "Trimmed" of white areas from all sizes and sorted by their SKU which are unique. For example 123BLK1, 123BLK2, 123BLK3 etc.. The photos were taken from the same place in the same angles same lens and everything. Think of an object that found in a the tightest white background possible by his lines.
  I found out that after I take a series of pictures and find the longest or highest dimension of all series, If I open a square canvas in a size 5% bigger then the biggest dimension of all series, I get the series perfectly centered and with the right proportions between angles!!
  My idea was to make a script that creates a sorted database out the files in the folder and save the biggest dimension out of the series and then open the square canvas in that dimension. Like a dictionary database, that the cells will have the pictures names and the key will be the biggest dimension. Then, for every picture series, open a square canvas in the size of the key.
  For example, if I have these pictures in the folder, the dictionary will sort every 5 SKU with the same number and same color (different angle 1..5), save the biggest dimension in the key and open the square canvas for each series by it's key SKU Width Hight Series Key 123BLK1 850 1200
  123BLK2 1300 1400
  123BLK3 1500 600
  123BLK4 1900 900 1900 123BLK5 1100 1700
  123GRY1 750 1000
  123GRY2 900 1800 1800 123GRY3 1200 1500
  123GRY4 1400 1300
  123GRY5 1100 750
  I Just wrote a code in Python. If somebody knows how to make it in JS for CS6 i'll really appreciate it.
  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)
  No idea what that script is, it is not JavaScript... possibly a variant of Actionscript or Ghostscript, as I said, this is a script for the algorithm that I wrote in Python language.
  What I'm looking for is to write the same script in JS for photoshop CS6.
  If you understand the algorithm and might help me with the commands to write in JS that will help me a lot!
  Thanks
  If your pictures are on a web server, check that python is not already installed, if not do this in PHP as it has image functions for resizing and you can find already made thumbnail routines by searching google.
  If not then I suggest that you install a development server on your computer like XAMPP
  There are currently 1 users browsing this thread. (0 members and 1 guests)
  View Tag Cloud
  Forum Rules