-
Notifications
You must be signed in to change notification settings - Fork 0
/
collect_exposures.py
executable file
·636 lines (564 loc) · 24 KB
/
collect_exposures.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#########################################################################################
# collect_exposures.py
#
# Author: Philipp Lutz (philipp.lutz@gmx.de)
#
# Description:
# ------------
# A little helper for managing exposure blends and doing batch processing.
# This script has to be started within gimp
#
# Documentation:
# --------------
#
# data structure for settings:
# [
# {"path": STRING,
# "files": STRING_ARRAY[3],
# "settings": {
# "blur": INT,
# "dark_mask": INT,
# "bright_mask": INT,
# "blur_radius": INT,
# "scale": STRING,
# "dark": INT,
# "trim": INT,
# "align": INT
# }
# },
# {
# ...
# }
# ]
#
#########################################################################################
#########################################################################################
# external programs
# -----------------
# please adjust the paths to the following programs if necessary
# e.g. if not in PATH variable or for other operating systems
# TODO: check if programs are available
#########################################################################################
CMD__ALIGN_IMAGE_STACK="align_image_stack"
CMD__MOGRIFY="mogrify"
CMD__JHEAD="jhead"
CMD__ENFUSE="enfuse"
PARAM__ENFUSE_DEFAULT= [
"--compression=100", # for JPG output don't use compression
"-m 4096", # amount of cache in MB
"-b 4096", # amount of buffer in MB
"--depth=float", # image depth for processing
"--save-masks=%f-softmask.png", # save masks...
]
PARAM__ENFUSE_FOCUS_STACKING= [
"--exposure-weight=0", # weight given to well-exposed pixels
"--saturation-weight=0", # weight given to highly-saturated pixels
"--contrast-weight=1", # weight given to pixels in high-contrast neighborhoods
"--hard-mask", # force hard blend masks and no averaging on finest scale
"--save-masks=%f-softmask.png", # save masks...
]
PARAM__ENFUSE_EXPOSURE_SERIES= [
"--save-masks=%f-softmask.png", # save masks...
]
ALLOWED_FILE_FORMATS=["JPG", "JPEG", "TIFF", "PNG"]
#########################################################################################
# Program start
#########################################################################################
from PIL import Image
import ImageStat
import threading
import Queue
import sys, os, subprocess, math
import wx
# we just assume the script is started in the context
# of a gimp-plugin and check whether it's true!
startedAsGimpPlugin = 1
try:
import gimp, gimpplugin
from gimpenums import *
pdb = gimp.pdb
except ImportError as error:
# ok, we assume that script has been called outside gimp context
startedAsGimpPlugin = 0
for arg in sys.argv[1:]:
if "gimp" in arg:
startedAsGimpPlugin = 1
print "Now that's weird, while gimp started this script the script can't find the gimp libraries..."
pass
print "startedAsGimpPlugin = %d" % startedAsGimpPlugin
# Blending modes
MODE__LUMINOSITY_MASKS = 1
MODE__ENFUSE = 2
MODE__ALIGN = 3 # just align images and save aligned files
# Button IDs
ID_NEW = 1
ID_CLEAR = 2
ID_DELETE = 3
ID_CONFIG = 4
ID_PROCESS = 5
ID_ENFUSE = 6
ID_ALIGN = 7
# Default settings for blending
DEFAULT_SETTINGS = {"blur":0,
"dark_mask":0,
"bright_mask":0,
"blur_radius":8,
"scale":"",
"dark":0,
"trim":0,
"align":0}
# Standard directory which pops up when adding exposure stacks to the list
CURRENT_DIR="/home/phil"
myEVT_JOB_DONE = wx.NewEventType()
EVT_JOB_DONE = wx.PyEventBinder(myEVT_JOB_DONE, 1)
class ConfigureDialog(wx.Dialog):
def __init__(self, parent, title, item):
super(ConfigureDialog, self).__init__(parent=parent, title=title, size=(450, 280))
self.parent = parent
self.item = item
self.settings = parent.list_items[item]["settings"]
blur_choices=["Gaussian/None", "Selective/Low", "Selective/Medium", "Selective/High"]
dark_mask_choices=["Dark", "Normal", "Bright"]
bright_mask_choices=["Bright (inverted)", "Normal (inverted)", "Dark (inverted)"]
self.label_7 = wx.StaticText(self, -1, "Blur Type / Edge Protection")
self.blur = wx.ComboBox(self, -1, choices=blur_choices, value=blur_choices[0],
style=wx.CB_DROPDOWN|wx.CB_READONLY)
self.label_8 = wx.StaticText(self, -1, "Dark Mask Grayscale")
self.dark_mask = wx.ComboBox(self, -1, choices=dark_mask_choices, value=dark_mask_choices[0],
style=wx.CB_DROPDOWN|wx.CB_READONLY)
self.label_9 = wx.StaticText(self, -1, "Bright Mask Grayscale")
self.bright_mask = wx.ComboBox(self, -1, choices=bright_mask_choices,
value=bright_mask_choices[0], style=wx.CB_DROPDOWN|wx.CB_READONLY)
self.label_10 = wx.StaticText(self, -1, "Blend Mask Blur Radius")
self.blur_radius = wx.SpinCtrl(self, -1, "8", min=0, max=100)
self.label_11 = wx.StaticText(self, -1, "Scale Largest Image Dimension to")
self.scale = wx.TextCtrl(self, -1, "")
self.label_12 = wx.StaticText(self, -1, "Dark Takes Precedence")
self.dark_takes_precedence = wx.CheckBox(self, -1, "", style=wx.ALIGN_RIGHT)
self.label_13 = wx.StaticText(self, -1, "Auto-Trim Mask Histograms")
self.auto_trim_mask_hist = wx.CheckBox(self, -1, "", style=wx.ALIGN_RIGHT)
self.label_14 = wx.StaticText(self, -1, "Align Layers")
self.align_layers = wx.CheckBox(self, -1, "", style=wx.ALIGN_RIGHT)
self.defaultsButton = wx.Button(self, -1, "Defaults")
self.okButton = wx.Button(self, -1, "Ok")
sizer_1 = wx.BoxSizer(wx.VERTICAL)
grid_sizer_1 = wx.FlexGridSizer(6, 2, 3, 12)
grid_sizer_1.Add(self.label_7, 0, 0, 0)
grid_sizer_1.Add(self.blur, 0, 0, 0)
grid_sizer_1.Add(self.label_8, 0, 0, 0)
grid_sizer_1.Add(self.dark_mask, 0, 0, 0)
grid_sizer_1.Add(self.label_9, 0, 0, 0)
grid_sizer_1.Add(self.bright_mask, 0, 0, 0)
grid_sizer_1.Add(self.label_10, 0, 0, 0)
grid_sizer_1.Add(self.blur_radius, 0, 0, 0)
grid_sizer_1.Add(self.label_11, 0, 0, 0)
grid_sizer_1.Add(self.scale, 0, 0, 0)
grid_sizer_1.Add(self.label_12, 0, 0, 0)
grid_sizer_1.Add(self.dark_takes_precedence, 0, 0, 0)
grid_sizer_1.Add(self.label_13, 0, 0, 0)
grid_sizer_1.Add(self.auto_trim_mask_hist, 0, 0, 0)
grid_sizer_1.Add(self.label_14, 0, 0, 0)
grid_sizer_1.Add(self.align_layers, 0, 0, 0)
grid_sizer_1.Add(self.defaultsButton, 0, wx.EXPAND, 0)
grid_sizer_1.Add(self.okButton, 0, wx.EXPAND, 0)
sizer_1.Add(grid_sizer_1, 1, wx.ALL|wx.EXPAND|wx.ALIGN_CENTER_HORIZONTAL, 5)
self.SetSizer(sizer_1)
self.Layout()
self.okButton.Bind(wx.EVT_BUTTON, self.OnClose)
self.defaultsButton.Bind(wx.EVT_BUTTON, self.OnDefaults)
self.loadSettings(self.settings)
def OnDefaults(self, e):
self.loadSettings(DEFAULT_SETTINGS)
def loadSettings(self, settings):
# load settings...
self.blur.SetSelection(settings["blur"])
self.dark_mask.SetSelection(settings["dark_mask"])
self.bright_mask.SetSelection(settings["bright_mask"])
self.blur_radius.SetValue(settings["blur_radius"])
self.scale.SetValue(settings["scale"])
self.dark_takes_precedence.SetValue(settings["dark"])
self.auto_trim_mask_hist.SetValue(settings["trim"])
self.align_layers.SetValue(settings["align"])
def OnClose(self, e):
# save settings...
settings={}
settings["blur"]=self.blur.GetSelection()
settings["dark_mask"]=self.dark_mask.GetSelection()
settings["bright_mask"]=self.bright_mask.GetSelection()
settings["blur_radius"]=self.blur_radius.GetValue()
settings["scale"]=self.scale.GetValue()
settings["dark"]=self.dark_takes_precedence.GetValue()
settings["trim"]=self.auto_trim_mask_hist.GetValue()
settings["align"]=self.align_layers.GetValue()
self.parent.list_items[self.item]["settings"]=settings
self.Destroy()
class FileDrop(wx.FileDropTarget):
def __init__(self, window):
wx.FileDropTarget.__init__(self)
self.window = window
def OnDropFiles(self, x, y, filenames):
# check if we can read all files and if the filetypes are supported
total_count = 0
count = 0
for name in filenames:
total_count += 1
try:
file = open(name, 'r')
file.close()
except IOError, error:
dlg = wx.MessageDialog(None, 'Error opening file\n' + str(error))
dlg.ShowModal()
return
for filetype in ALLOWED_FILE_FORMATS:
if name.upper().endswith(filetype.upper()):
count += 1
if count != total_count:
dlg = wx.MessageDialog(None, 'Filetype not supported')
dlg.ShowModal()
return
self.window.NewItem(filenames)
class BlendDoneEvent(wx.PyCommandEvent):
"""Event to signal that a count value is ready"""
def __init__(self, etype, eid, value=None):
"""Creates the event object"""
wx.PyCommandEvent.__init__(self, etype, eid)
self._value = value
def GetValue(self):
"""Returns the value from the event.
@return: the value of this event
"""
return self._value
class MainWindow(wx.Frame):
def __init__(self, parent, id, title):
self.list_items = []
self.list_item_count = 0
self.currentDirectory = CURRENT_DIR
self.batch = ""
self.active_jobs = []
wx.Frame.__init__(self, parent, id, title, size=(750, 300))
panel = wx.Panel(self, -1)
hbox = wx.BoxSizer(wx.HORIZONTAL)
self.listbox = wx.ListBox(panel, -1)
hbox.Add(self.listbox, 1, wx.EXPAND | wx.ALL, 20)
btnPanel = wx.Panel(panel, -1)
vbox = wx.BoxSizer(wx.VERTICAL)
self.new = wx.Button(btnPanel, ID_NEW, 'New', size=(90, 30))
self.dlt = wx.Button(btnPanel, ID_DELETE, 'Delete', size=(90, 30))
self.clr = wx.Button(btnPanel, ID_CLEAR, 'Clear', size=(90, 30))
self.config = wx.Button(btnPanel, ID_CONFIG, 'Configure', size=(90, 30))
self.align = wx.Button(btnPanel, ID_ALIGN, 'Align', size=(90, 30))
self.process = wx.Button(btnPanel, ID_PROCESS, 'Process', size=(90, 30))
self.enfuse = wx.Button(btnPanel, ID_ENFUSE, 'Enfuse', size=(90, 30))
self.Bind(wx.EVT_BUTTON, self.AddFiles, id=ID_NEW)
self.Bind(wx.EVT_BUTTON, self.OnConfigure, id=ID_CONFIG)
self.Bind(wx.EVT_BUTTON, self.OnDelete, id=ID_DELETE)
self.Bind(wx.EVT_BUTTON, self.OnClear, id=ID_CLEAR)
self.Bind(wx.EVT_BUTTON, self.OnProcess, id=ID_PROCESS)
self.Bind(wx.EVT_BUTTON, self.OnEnfuse, id=ID_ENFUSE)
self.Bind(wx.EVT_BUTTON, self.OnAlign, id=ID_ALIGN)
self.Bind(wx.EVT_LISTBOX_DCLICK, self.OnConfigure)
self.Bind(wx.EVT_LISTBOX, self.OnSelect)
self.Bind(EVT_JOB_DONE, self.OnJobDone)
vbox.Add((-1, 20))
vbox.Add(self.new)
vbox.Add(self.dlt, 0, wx.TOP, 5)
vbox.Add(self.clr, 0, wx.TOP, 5)
vbox.Add((0, 20))
vbox.Add(self.config, 0, wx.TOP, 5)
vbox.Add(self.align, 0, wx.TOP, 5)
vbox.Add(self.process, 0, wx.TOP, 5)
vbox.Add(self.enfuse, 0, wx.TOP, 5)
btnPanel.SetSizer(vbox)
hbox.Add(btnPanel, 0.6, wx.EXPAND | wx.RIGHT, 20)
panel.SetSizer(hbox)
self.dlt.Disable()
self.config.Disable()
self.clr.Disable()
self.align.Disable()
self.process.Disable()
self.enfuse.Disable()
dt = FileDrop(self)
self.listbox.SetDropTarget(dt)
self.Centre()
self.Show(True)
def OnSelect(self, event):
sel = event.GetSelection()
if sel < 0:
self.config.Disable()
self.align.Disable()
self.dlt.Disable()
self.process.Disable()
else:
self.config.Enable()
self.dlt.Enable()
if self.active_jobs[sel] == 0:
self.align.Enable()
self.process.Enable()
self.enfuse.Enable()
else:
self.align.Disable()
self.process.Disable()
self.enfuse.Disable()
def AddFiles(self, event):
my_wildcard="JPG Files (*.jpg; *.JPG)|*.jpg;*.JPG| TIF Files (*.tif; *.TIF)|*.tif;*.TIF\
| PNG files (*.png; *.PNG)|*.png;*.PNG| All files (*.*)|*.*"
dlg = wx.FileDialog(self, message="Choose a file",
defaultDir=self.currentDirectory,
wildcard=my_wildcard,style=wx.OPEN | wx.MULTIPLE)
if dlg.ShowModal() == wx.ID_OK:
paths = dlg.GetPaths()
self.NewItem(paths)
dlg.Destroy()
def NewItem(self, paths):
files = []
count = 0
root = ""
for path in paths:
count += 1
print path
[root, single_file] = path.rsplit('/',1)
files.append(single_file)
if count < 2:
wx.MessageBox("Please select at least 2 pictures!", "Info", wx.OK | wx.ICON_ERROR)
else:
text = ' | '.join(files)
if text != '':
self.active_jobs.append(0)
self.listbox.Append(text)
self.clr.Enable()
self.list_items.append({"path": root+"/", "files": files, "settings": DEFAULT_SETTINGS})
self.list_item_count += 1
print self.list_items
print self.list_item_count
def OnConfigure(self, event):
sel = self.listbox.GetSelection()
text = self.listbox.GetString(sel)
configDlg = ConfigureDialog(self, 'Settings', sel)
configDlg.ShowModal()
configDlg.Destroy()
def OnDelete(self, event):
sel = self.listbox.GetSelection()
text = self.listbox.GetString(sel)
if sel != -1:
self.listbox.Delete(sel)
self.list_items.pop(sel)
self.active_jobs.remove(sel)
self.list_item_count -= 1
if self.list_item_count == 0:
self.clr.Disable()
def OnClear(self, event):
self.listbox.Clear()
self.clr.Disable()
self.align.Disable()
self.process.Disable()
self.enfuse.Disable()
del self.list_items[:]
self.list_item_count = 0
self.active_jobs = []
def OnAlign(self, event):
sel = self.listbox.GetSelection()
self.align.Disable()
self.process.Disable()
self.enfuse.Disable()
self.active_jobs[sel] = 1;
self.batch = blend(self, sel, MODE__ALIGN,
self.list_items[sel]["path"],
self.list_items[sel]["files"],
self.list_items[sel]["settings"]["align"])
self.batch.start()
def OnProcess(self, event):
sel = self.listbox.GetSelection()
self.align.Disable()
self.process.Disable()
self.enfuse.Disable()
self.active_jobs[sel] = 1;
self.batch = blend(self, sel, MODE__LUMINOSITY_MASKS,
self.list_items[sel]["path"],
self.list_items[sel]["files"],
self.list_items[sel]["settings"]["align"])
self.batch.start()
print "Start blending (main GUI thread)"
def OnEnfuse(self, event):
#
## TODO: check if enfuse is available at all before invoking it
#
sel = self.listbox.GetSelection()
self.active_jobs[sel] = 1;
self.align.Disable()
self.process.Disable()
self.enfuse.Disable()
self.batch = blend(self, sel, MODE__ENFUSE,
self.list_items[sel]["path"],
self.list_items[sel]["files"],
self.list_items[sel]["settings"]["align"])
self.batch.start()
def OnJobDone(self, event):
sel = event.GetValue()
print "Processing of list entry %s done" % (sel)
self.active_jobs[sel] = 0
self.align.Enable()
self.process.Enable()
self.enfuse.Enable()
self.batch.join()
class blend(threading.Thread):
def __init__(self, parent, task, mode, root, files, align=0):
self.id = task
self.mode = mode
self.parent = parent
self.path = root
self.files = files # sorted to: dark_exp, normal_exp, bright_exp
self._align = align
self.prefix="aligned"
self.blur_radius = 8
self.blur_typ = 0 # 0 - Gaussian / None
# 1 - Selective / Low
# 2 - Selective / Medium
# 3 - Selective / High
self.dark_mask_grayscale = 0 # 0 - dark
# 1 - normal
# 2 - bright
self.bright_mask_grayscale = 0 # 0 - bright (inverted)
# 1 - normal (inverted)
# 2 - dark (inverted)
self.dark_takes_precedence = 0 # 0 - disabled
# 1 - enabled
self.auto_trim_mask_histograms = 0 # 0 - disabled
# 1 - enabled
self.scale_largest_dim_to = ""
threading.Thread.__init__(self)
def run(self):
print "Los gehts!"
os.chdir(self.path)
self.start_blend()
evt = BlendDoneEvent(myEVT_JOB_DONE, -1, self.id)
wx.PostEvent(self.parent, evt)
def align(self):
"""
Align bracketed files with the help of the tool 'align_image_stack', which
is part of the hugin stitching suite. Only recommended when bracketed images
have been created handheld
"""
count=0
files=[]
command=[CMD__ALIGN_IMAGE_STACK, "-a", self.prefix]
command.extend(self.files)
output = subprocess.Popen(command).communicate()[0]
for file in self.files:
tmp_filename=self.prefix+str(count).zfill(4)+".tif"
new_filename=file.rsplit(".",1)[0]+"_"+self.prefix
files.append(new_filename+".jpg")
os.rename(tmp_filename,new_filename+".tif")
command=[CMD__MOGRIFY,"-format","jpg","-quality","100",new_filename+".tif"]
output = subprocess.Popen(command).communicate()[0]
command=[CMD__JHEAD,"-te",file,new_filename+".jpg"]
output = subprocess.Popen(command).communicate()[0]
os.remove(new_filename+".tif")
count+=1
self.files = files # update filenames
def sort_exposures(self):
"""
Sort files in this order (dark to bright): dark_exp, normal_exp, bright_exp
according to the histogram mean value of the blue channel with index 2 (R, G, B)
Return the sorted files, does not change self.files!
"""
files = []
means = []
hist_mean = {}
os.chdir(self.path)
print "--- Sorting bracketing exposures..."
for file in self.files:
im = Image.open(self.path+file)
stat = ImageStat.Stat(im)
hist_mean[file] = int(stat.mean[2])
means.append(int(stat.mean[2]))
means.sort()
for m in means:
for hist_f, hist_m in hist_mean.iteritems():
if(hist_m == m):
print "Mean histogram value: %d (image: %s)" % (m, hist_f)
files.append(hist_f)
return files
def start_blend(self):
i = 0
if (self._align == 1) or (self.mode == MODE__ALIGN):
print "--- Aligning bracketing exposures..."
self.align()
print "--- Alignment finised"
if (self.mode == MODE__LUMINOSITY_MASKS):
files = self.sort_exposures()
print "files:"
print files
print "self.files:"
print self.files
print "normal exp: %s" % self.path+files[1]
print "dark exp: %s" % self.path+files[0]
print "bright exp: %s" % self.path+files[2]
pdb.script_fu_exposure_blend(self.path+files[1], # normal_exp
self.path+files[0], # dark_exp
self.path+files[2], # bright_exp,
self.blur_radius,
self.blur_typ,
self.dark_mask_grayscale,
self.bright_mask_grayscale,
self.dark_takes_precedence,
self.auto_trim_mask_histograms,
self.scale_largest_dim_to
)
elif (self.mode == MODE__ENFUSE):
files = self.files
enfuse_filename = files[0].rsplit(".",1)[0]+"_enfuse"+str(i)+".jpg"
while os.path.exists(enfuse_filename):
i += 1
enfuse_filename = files[0].replace(".jpg", "")+"_enfuse"+str(i)+".jpg"
# add the following constants as arguments:
# - PARAM__ENFUSE_EXPOSURE_SERIES
# - PARAM__ENFUSE_DEFAULT
command = [CMD__ENFUSE] + PARAM__ENFUSE_DEFAULT + ["-o", enfuse_filename]
command.extend(files)
print "command: '%s'" % " ".join(command)
output = subprocess.Popen(command).communicate()[0]
#filename = self.path + normal_exp.split(".")[0] + ".xcf"
#cur_drawable = pdb.gimp_image_get_active_drawable(img)
#pdb.gimp_xcf_save(img, cur_drawable, filename, normal_exp.split(".")[0])
if startedAsGimpPlugin:
print "Started as gimp plug-in!"
class ExposureBlendingBatch(gimpplugin.plugin):
def start(self):
gimp.main(self.init, self.quit, self.query, self._run)
def init(self):
pass
def quit(self):
pass
def query(self):
authorname = "Philipp Lutz"
copyright = "Philipp Lutz"
menu_location = "<Image>/Filters/Misc/Batch Blend Test"
date = "November 2011"
description = "Test"
help = "Test"
params = [(PDB_INT32, "run_mode", "Run mode")]
gimp.install_procedure("py_exposure_blending_batch",
description,
help,
authorname,
copyright,
date,
menu_location,
"",
PLUGIN,
params,
[])
def py_exposure_blending_batch(self, runmode):
app = wx.App()
MainWindow(None, -1, 'Exposure Blending Batch')
app.MainLoop()
if __name__ == '__main__':
if startedAsGimpPlugin:
print "Started script as gimp plug-in!"
ExposureBlendingBatch().start()
else:
app = wx.App()
MainWindow(None, -1, 'Exposure Blending Batch')
app.MainLoop()