It is currently Fri Apr 19, 2024 6:25 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 295 posts ]  Go to page Previous  1, 2, 3, 4, 5 ... 15  Next
Author Message
 Post subject: Re: XNViewShell
PostPosted: Fri Jan 07, 2011 8:04 pm  (#21) 
Offline
GimpChat Member
User avatar

Joined: Jul 04, 2010
Posts: 2253
Location: Retired Moderator Slowly Returning to the Living.
Let me try this again...

It's no go on Win7 64bit. I don't want to install XnView in the regular "Program Files" directory, as this is reserved for 64 bit programs. I am looking into another option.

_________________
Artists aren't crazy! We're eccentric! ~G.M. Ross

Image

My Sigs = My Photos
Check out my work at http://www.flickr.com/photos/photomastergreg.


Top
 Post subject: Re: XNViewShell
PostPosted: Fri Jan 07, 2011 8:06 pm  (#22) 
Offline
Global Moderator
User avatar

Joined: Oct 06, 2010
Posts: 4045
PM:

You can change the path in the PY file to suit the installation location. You just need to use double \\ .

I wish I could get it to work in Ubuntu, how sweet that would be.

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


Top
 Post subject: Re: XNViewShell
PostPosted: Fri Jan 07, 2011 8:09 pm  (#23) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12516
OK; The original image as embedded alpha and the result shown is after I ran Cybia's Alphaworks filter and got placed back into GIMP (identical as before running the filter). The second version how it should be. I saved it while still in XNView. I have an idea why this is happening. Maybe if you can figure out how to paste it back in another layer besides the calling layer, you can get the proper result. :)

Attachment:
ducky_fill.png
ducky_fill.png [ 209.71 KiB | Viewed 6808 times ]


Attachments:
gimp-temp-210415.png
gimp-temp-210415.png [ 268.73 KiB | Viewed 6808 times ]

_________________
Lyle

Psalm 109:8

Image
Top
 Post subject: Re: XNViewShell
PostPosted: Fri Jan 07, 2011 8:13 pm  (#24) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12516
Ah; just tried it with a layer that already has transparancy components and the result that comes back is different then if I saved it externally further backing what I think is the problem. :)

What should be the result:

Attachment:
gimp-temp-210418.png
gimp-temp-210418.png [ 338.69 KiB | Viewed 6806 times ]


What comes back inside GIMP:

Attachment:
gimp-temp-210415b.png
gimp-temp-210415b.png [ 317.45 KiB | Viewed 6806 times ]

_________________
Lyle

Psalm 109:8

Image


Top
 Post subject: Re: XNViewShell
PostPosted: Fri Jan 07, 2011 8:26 pm  (#25) 
Offline
Global Moderator
User avatar

Joined: Oct 06, 2010
Posts: 4045
Rob: I don't know how I missed your post. I thought I was keeping a good eye for any replies and somehow I missed your post. Hmmm... Anyway, thanks for trying. I truly appreciate that.

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


Top
 Post subject: Re: XNViewShell
PostPosted: Fri Jan 07, 2011 8:54 pm  (#26) 
Offline
Script Coder
User avatar

Joined: Jul 14, 2010
Posts: 697
mahvin wrote:
Rob: I don't know how I missed your post. I thought I was keeping a good eye for any replies and somehow I missed your post. Hmmm... Anyway, thanks for trying. I truly appreciate that.


OK - I installed wine and xnview and this seems to work:
  # 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
  tempwinfile = "C:\\Windows\\Temp\\tempfile.png"
  tempfilename = "/home/rob/.wine/dosdevices/c:/windows/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 - Change to match where you installed XnView
  command = "/usr/bin/wine \"C:\\Program Files\\XnView\\xnview.exe\" \"" + tempwinfile + "\""
  gimp.message(command)
  args = shlex.split(command)


Just replace the bits of the previous version and change your home/rob/ path to yours.

This is necessary to overcome the wine/linux paths.

-Rob A>

_________________
Image
Fantasy Cartography and Mapping by RobA


Top
 Post subject: Re: XNViewShell
PostPosted: Fri Jan 07, 2011 9:12 pm  (#27) 
Offline
Global Moderator
User avatar

Joined: Oct 06, 2010
Posts: 4045
Results:

Traceback (most recent call last):
File "/usr/lib/gimp/2.0/python/gimpfu.py", line 692, in response
dialog.res = run_script(params)
File "/usr/lib/gimp/2.0/python/gimpfu.py", line 353, in run_script
return apply(function, params)
File "/home/mahvin/.gimp-2.6/plug-ins/XNViewShell.py", line 73, in plugin_main
args = shlex.split(command)
NameError: global name 'shlex' is not defined

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


Top
 Post subject: Re: XNViewShell
PostPosted: Fri Jan 07, 2011 9:14 pm  (#28) 
Offline
Script Coder
User avatar

Joined: Jul 14, 2010
Posts: 697
lylejk wrote:
Ah; just tried it with a layer that already has transparancy components and the result that comes back is different then if I saved it externally further backing what I think is the problem. :)


I think I figured it out. It was pasting into the original selection, so if the filter removed alpha, the old image showed through...

Try the attached.


Attachments:
XNViewShell.zip [1.84 KiB]
Downloaded 854 times

_________________
Image
Fantasy Cartography and Mapping by RobA
Top
 Post subject: Re: XNViewShell
PostPosted: Fri Jan 07, 2011 9:15 pm  (#29) 
Offline
Script Coder
User avatar

Joined: Jul 14, 2010
Posts: 697
mahvin wrote:
Results:

Traceback (most recent call last):
File "/usr/lib/gimp/2.0/python/gimpfu.py", line 692, in response
dialog.res = run_script(params)
File "/usr/lib/gimp/2.0/python/gimpfu.py", line 353, in run_script
return apply(function, params)
File "/home/mahvin/.gimp-2.6/plug-ins/XNViewShell.py", line 73, in plugin_main
args = shlex.split(command)
NameError: global name 'shlex' is not defined


oops. Forgot. Add a
import shlex

with the other imports

I'm just duffing so I hope this works, at least well enough for you to figure it out.

-Rob A>

_________________
Image
Fantasy Cartography and Mapping by RobA


Top
 Post subject: Re: XNViewShell
PostPosted: Fri Jan 07, 2011 9:22 pm  (#30) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12516
Your new version worked Rob (of course had to change the path back to PF in my case; lol). Thanks a heap. :)

_________________
Lyle

Psalm 109:8

Image


Top
 Post subject: Re: XNViewShell
PostPosted: Fri Jan 07, 2011 9:24 pm  (#31) 
Offline
Global Moderator
User avatar

Joined: Oct 06, 2010
Posts: 4045
Bwahahahahahaha. AWESOMENESS! I hereby nominate RobA the Coder of the Year for 2011! Thanks, Rob! W000t! Worked perfectly.

Image
Use of one of my proprietary plug-ins.

Also an interesting observation: this .py plug-in actually got XnView to work properly. Meaning, prior to this, when using XnView, if I closed ANY image after viewing, XnView would crash. I've run several edits, and so far (knocking on wood) XnView hasn't crashed after closing an image.

Many thanks!

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


Top
 Post subject: Re: XNViewShell
PostPosted: Fri Jan 07, 2011 9:31 pm  (#32) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12516
I concur Mahvin. RobA's the coder of the year for sure. Hope he decides to share this Python plugin at the Registry. Can finally say goodbye to PSPI (well, almost; can't get Impressionist to even show up in XNView; lol). :)

_________________
Lyle

Psalm 109:8

Image


Top
 Post subject: Re: XNViewShell
PostPosted: Fri Jan 07, 2011 10:04 pm  (#33) 
Offline
GimpChat Member
User avatar

Joined: Jul 04, 2010
Posts: 2253
Location: Retired Moderator Slowly Returning to the Living.
I get the menu option, so the path is good. When I select it, a box pops up asking "new from visible" or "current layer", and when I press "ok", I get a progress bar and it creates a new layer, but never launches XnView.

_________________
Artists aren't crazy! We're eccentric! ~G.M. Ross

Image

My Sigs = My Photos
Check out my work at http://www.flickr.com/photos/photomastergreg.


Top
 Post subject: Re: XNViewShell
PostPosted: Fri Jan 07, 2011 10:06 pm  (#34) 
Offline
Global Moderator
User avatar

Joined: Oct 06, 2010
Posts: 4045
Did you download Rob's latest version? His last zip attachment?

_________________
"In order to attain the impossible, one must attempt the absurd."
~ Miguel de Cervantes


Top
 Post subject: Re: XNViewShell
PostPosted: Fri Jan 07, 2011 10:18 pm  (#35) 
Offline
GimpChat Member
User avatar

Joined: Jul 04, 2010
Posts: 2253
Location: Retired Moderator Slowly Returning to the Living.
I just downloaded the latest, changed the path and it works sweetly with Win7 64bit! Great coding!!

_________________
Artists aren't crazy! We're eccentric! ~G.M. Ross

Image

My Sigs = My Photos
Check out my work at http://www.flickr.com/photos/photomastergreg.


Top
 Post subject: Re: XNViewShell
PostPosted: Fri Jan 07, 2011 10:59 pm  (#36) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5870
thank RobA

_________________
My 3D Gallery on Deviantart http://photocomix2.deviantart.com/
Main gallery http://www.flickriver.com/photos/photocomix-mandala/
Mandala and simmetry http://www.flickriver.com/photos/photocomix_mandala/

Image

Mrs Wilbress


Top
 Post subject: Re: XNViewShell
PostPosted: Sat Jan 08, 2011 4:56 am  (#37) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
LOL, all i did was copy the XnView directory to a new folder called PF in C directory - opened Gimp and it works now!
Oh and changed the path to PF instead of Program Files.

Thanks Rob!

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: XNViewShell
PostPosted: Sat Jan 08, 2011 5:49 am  (#38) 
Offline
Global Moderator
User avatar

Joined: Apr 07, 2010
Posts: 14182
I put the new plugin into my 2.6 plugins and XnView now shows under filters. I didn't change any paths, just looked at it with notepad++ and it looks Greek to me...
Anyway, I can see it now. I will have to learn what it does next. :geek thanx RobA

_________________
Image


Top
 Post subject: Re: XNViewShell
PostPosted: Sat Jan 08, 2011 6:29 am  (#39) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
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.

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: XNViewShell
PostPosted: Sat Jan 08, 2011 6:43 am  (#40) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Rob would it be possible to use this to call say just one 8bf filter?
Like say i want to call just my Alien Skin filters.
Could i throw them into PF and call them from there or would it need to be an exe?
I was thinking maybe change this line
# Command line
path = "c:\\PF\\DeepPaint\\"
command = path + "deeppaint.exe " + "\"" + tempfilename + "\""

to

# Command line
path = "c:\\PF\\AlienskinProgramNameHere\\"
command = path + "alienskinpluginnamehere.8bf " + "\"" + tempfilename + "\""

Would that work?
That would be cool!

I guess what i am asking is, can you call any extension with this Python file?

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
Post new topic Reply to topic  [ 295 posts ]  Go to page Previous  1, 2, 3, 4, 5 ... 15  Next

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) Extended version ShellOut.

1

No new posts Attachment(s) How to call a python filter to run interactively

10



* Login  



Powered by phpBB3 © phpBB Group