Automatize picture preprocessing...
Hi!
I wanna automatize the photo picture preprocessing.
I wanna call the auto color converters from python, if possible, without
open the gimp, and open the files.
For example I wanna make auto white, auto level, auto color on all pictures,
and make 3 images from the original to check what correction is better for
it.
How can I do this? Can I do this like withPhotoShop API?
See my PS code:
# encoding: iso-8859-2
import win32com.client, os, sys
app = win32com.client.Dispatch("Photoshop.Application")
#print cs.ActiveDocument.Name
while 1:
l = app.Documents.Count
if l > 0:
if app.ActiveDocument <> None:
app.ActiveDocument.Close(2)
import time
time.sleep(0.5)
else:
break
def ProcessImage(FileName):
for i in range(3):
app.Open(FileName);
doc = app.ActiveDocument;
if i == 0:
app.DoAction('KT', 'TEST')
elif i == 1:
layer = doc.ActiveLayer
layer.AutoLevels()
elif i == 2:
layer = doc.ActiveLayer
layer.AutoContrast()
jpgopt = win32com.client.Dispatch("Photoshop.JPEGSaveOptions")
jpgopt.Quality = 12
import os
bn, ext = os.path.splitext(FileName)
newfilename = bn + '_' + str(['col', 'lev', 'cnt'][i]) + ext
doc.SaveAs(newfilename, jpgopt)
doc.Close(2)
def GetFileList(top):
filenames = []
for root, dirs, files in os.walk(top, topdown=False):
for name in files:
b, e = os.path.splitext(name)
if e.lower() == '.jpg':
if b.find('_col') == -1 and b.find('_cnt') == -1 and b.find('_lev')
== -1:
filenames.append(os.path.join(root, name))
return filenames
I tried DBP (DPB?) but it isn't works for me in Windows XP.
Thanks for your help:
dd