Molly it calls the image program called XnView so you can edit a temp image in it with photo-shop filters as they run better in Xnview. Then it reopens it in Gimp with the changes....
sweet guess what i did Rob?
I altered your code just a little to call Deep Paint .. here is the code.
#!/usr/bin/env python
'''
DeepPaintShell.py
call DeepPaint ro allow processing using photoshop plugins. Windows Only.
Author:
Rob Antonishen
this script is modelled after the mm extern LabCurves trace plugin
by Michael Munzert http://www.mm-log.com/lab-curves-gimp
License:
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 3 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
The GNU Public License is available at
http://www.gnu.org/copyleft/gpl.html
'''
from gimpfu import *
import subprocess
import os, sys
def plugin_main(image, drawable, visible):
pdb.gimp_image_undo_group_start(image)
# Copy so the save operations doesn't affect the original
if visible == 0:
# Save in temporary. Note: empty user entered file name
temp = pdb.gimp_image_get_active_drawable(image)
else:
# Get the current visible
temp = pdb.gimp_layer_new_from_visible(image, image, "Visible")
image.add_layer(temp, 0)
buffer = pdb.gimp_edit_named_copy(temp, "DeepPaintShellTemp")
#save selection if one exists
hassel = pdb.gimp_selection_is_empty(image) == 0
if hassel:
savedsel = pdb.gimp_selection_save(image)
tempimage = pdb.gimp_edit_named_paste_as_new(buffer)
pdb.gimp_buffer_delete(buffer)
if not tempimage:
raise RuntimeError
pdb.gimp_image_undo_disable(tempimage)
tempdrawable = pdb.gimp_image_get_active_layer(tempimage)
# Use temp file names from gimp, it reflects the user's choices in gimp.rc
# change as indicated if you always want to use the same temp file name
tempfilename = pdb.gimp_temp_name("png")
#tempfilename = "C:\\Temp\\tempfile.png"
# !!! Note no run-mode first parameter, and user entered filename is empty string
pdb.gimp_progress_set_text ("Saving a copy")
pdb.file_png_save_defaults(tempimage, tempdrawable, tempfilename, tempfilename)
# Command line
path = "c:\\PF\\DeepPaint\\"
command = path + "deeppaint.exe " + "\"" + tempfilename + "\""
# Invoke external command
pdb.gimp_progress_set_text ("run DeepPaint...")
pdb.gimp_progress_pulse()
child = subprocess.Popen(command, shell=True)
child.communicate()
# put it as a new layer in the opened image
try:
newlayer2 = pdb.gimp_file_load_layer(tempimage, tempfilename)
except:
RuntimeError
tempimage.add_layer(newlayer2,-1)
buffer = pdb.gimp_edit_named_copy(newlayer2, "DeepPaintShellTemp")
if visible == 0:
sel = pdb.gimp_edit_named_paste(drawable, buffer, 1)
else:
sel = pdb.gimp_edit_named_paste(temp, buffer, 1)
pdb.gimp_buffer_delete(buffer)
pdb.gimp_floating_sel_anchor(sel)
#load up old selection
if hassel:
pdb.gimp_selection_load(savedsel)
image.remove_channel(savedsel)
# cleanup
os.remove(tempfilename) # delete the temporary file
gimp.delete(tempimage) # delete the temporary image
# Note the new image is dirty in Gimp and the user will be asked to save before closing.
pdb.gimp_image_undo_group_end(image)
gimp.displays_flush()
register(
"python_fu_deeppaintshell",
"Call Deep Paint",
"Call Deep Paint",
"Rob Antonishen",
"Copyright 2011 Rob Antonishen",
"2011",
"<Image>/Filters/Deep Paint...",
"RGB*, GRAY*",
[ (PF_RADIO, "visible", "Layer:", 1, (("new from visible", 1),("current layer",0)))
],
[],
plugin_main,
)
main()
I believe it will work with any program you want to call.This should be thrown into the master with a setup list of dif programs to call.
All i did was copy the Deep Paint directory to the PF directory in C directory.
Rename it to DeepPaint (no spaces)
Altered the code to above and tried it...worked excellent!
I used them both together no problems.
I love it - i don't think we need PSPI anymore. Ill keep it though. =P
No need for the ps path though.