It is currently Fri Apr 19, 2024 2:38 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 295 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7, 8, 9 ... 15  Next
Author Message
 Post subject: Re: XNViewShell
PostPosted: Sat Feb 05, 2011 4:20 am  (#101) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
For those of you interested in some of PaintDotNets filters and want to call that program from Gimp to say use Liquify, here is the code.

#!/usr/bin/env python

'''
Paint.NETShell.py
Call Paint.Net to allow use of Paint.Nets filters.  Windows Only.

Author:
Rob Antonishen

Version:
0.3 Fixed to work with filters that change alpha

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 shlex
import subprocess
import os, sys
import tempfile

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, "PaintDotNETShellTemp")

  #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 = os.path.join(tempfile.gettempdir(), "Inkscapetempfile.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 = "\"C:\\Program Files\\Paint.NET\\PaintDotNet.exe\" \"" + tempfilename + "\""
  args = shlex.split(command)

  # Invoke external command
  pdb.gimp_progress_set_text ("run PaintDotNET...")
  pdb.gimp_progress_pulse()
  child = subprocess.Popen(args, shell=False)
  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, "PaintDotNETShellTemp")

  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_edit_clear(temp)   
  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_paintdotnetshell",
        "Call PaintDotNET",
        "Call PaintDotNET",
        "Rob Antonishen",
        "Copyright 2011 Rob Antonishen",
        "2011",
        "<Image>/Filters/Call/PaintDotNET...",
        "RGB*, GRAY*",
        [ (PF_RADIO, "visible", "Layer:", 1, (("new from visible", 1),("current layer",0)))
        ],
        [],
        plugin_main,
        )

main()

Open in your editor, save as Paint.NETShell.py - place in the plug-ins folder.
Image from liquify in Paint.dot net
Exported from Gimp to paint, edited with the Liquify filter - and back to Gimp-
Image
This user submitted liquify filter is very nice.

_________________
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 - and other Programs you can call with Gimp
PostPosted: Sat Feb 05, 2011 7:21 am  (#102) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2241
Location: Poland
The Gimp is missing some features - for example - recording a macro?
OK - but it is XnviewSchell and PhotoFilterFactory (free version limited by the amount of effects and filters)

http://www.ezyware.com/PhotoFilterFactory.html

and you can create a (simple) own script and share with us the result (file *. scp)


Attachments:
cell PhotoFilterFactory.png
cell PhotoFilterFactory.png [ 689.81 KiB | Viewed 2031 times ]

_________________
Image

Slava
Ukraini!
Top
 Post subject: Re: XNViewShell - and other Programs you can call with Gimp
PostPosted: Sat Feb 05, 2011 11:11 pm  (#103) 
Offline
GimpChat Member
User avatar

Joined: Jul 04, 2010
Posts: 2253
Location: Retired Moderator Slowly Returning to the Living.
I installed AnamorphMe and PaintDotNET and their respective python scripts. The script worked great for PaintDotNet, and the one for Anamorph runs it fine, but saves the file with a modified name. So I do a copy in Anamorph before I close out of it and then do a File > Create > From Clipboard in Gimp. I don't paste it in as a layer since it's much larger than the original image. I'm going to modify my other scripts to put them in the call menu, too.

I also want to find that Liquify plugin!

_________________
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 - and other Programs you can call with Gimp
PostPosted: Sun Feb 06, 2011 12:24 am  (#104) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2241
Location: Poland
A lot of other filters to Paint.Net requires its own installation
http://forums.getpaint.net/index.php?/forum/7-plugins-publishing-only/?s=547fec9d0315710a838293dfc1a1af79
including 8bf
http://forums.getpaint.net/index.php?/topic/20622-psfilterpdn-2011-01-28/

_________________
Image

Slava
Ukraini!


Top
 Post subject: Re: XNViewShell - and other Programs you can call with Gimp
PostPosted: Sun Feb 06, 2011 1:14 am  (#105) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
PhotoMaster wrote:
I installed AnamorphMe and PaintDotNET and their respective python scripts. The script worked great for PaintDotNet, and the one for Anamorph runs it fine, but saves the file with a modified name. So I do a copy in Anamorph before I close out of it and then do a File > Create > From Clipboard in Gimp. I don't paste it in as a layer since it's much larger than the original image. I'm going to modify my other scripts to put them in the call menu, too.

I also want to find that Liquify plugin!


That program Photo Filter Factory - i bought the pro version - tried to install it and got a specialist 32 installer error - and no 8bfs installed after the b catagory.
I sent a support email to them, and am waiting on an answer.


PM you can download the enire plug-in package here for Paint Do Net.
Just unzip it to your effects folder in the program directory of PDN. :)
You will find it under Effects/Tools/Liquify
Along with some other great filters!

Enjoy!

_________________
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 - and other Programs you can call with Gimp
PostPosted: Sun Feb 06, 2011 4:52 pm  (#106) 
Offline
GimpChat Member
User avatar

Joined: Jul 04, 2010
Posts: 2253
Location: Retired Moderator Slowly Returning to the Living.
I downloaded several and they are pretty good. I did find a problem with PaintDotNET. It can't handle 12mp images very well. I gave it one of my 12mp jpegs and ran the Oil Paint filter, as it looks to do a realistic job with it. When I got it right, I saved it. When I opened the file in Gimp, the image was trash. I tried to open it in other programs and they showed it as trash, too. I tried it 4 times and got the same result each time. It's a shame.

_________________
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 - and other Programs you can call with Gimp
PostPosted: Mon Feb 07, 2011 12:47 am  (#107) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Yeah that really is, i didn't know that. Maybe you should post a question about that on flickr or paint dot nets forum.
Thanks for the heads up. :)

_________________
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 - and other Programs you can call with Gimp
PostPosted: Mon Feb 07, 2011 9:46 pm  (#108) 
Offline
GimpChat Member
User avatar

Joined: Jul 04, 2010
Posts: 2253
Location: Retired Moderator Slowly Returning to the Living.
Well the good news is that the 12mp problem on PaintDotNET, was something with specific pictures. I just used it on a different file and it worked perfectly.

_________________
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 - and other Programs you can call with Gimp
PostPosted: Tue Feb 08, 2011 2:07 pm  (#109) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2241
Location: Poland
Question about the next version
Will this be possible?


Attachments:
PC_OPTION.png
PC_OPTION.png [ 13.85 KiB | Viewed 1969 times ]

_________________
Image

Slava
Ukraini!
Top
 Post subject: Re: XNViewShell - and other Programs you can call with Gimp
PostPosted: Tue Feb 08, 2011 2:36 pm  (#110) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12516
That would be a cool idea so long as the one you like using the most can be coded as the default setting. :)

_________________
Lyle

Psalm 109:8

Image


Top
 Post subject: Re: XNViewShell - and other Programs you can call with Gimp
PostPosted: Tue Feb 08, 2011 11:13 pm  (#111) 
Offline
Script Coder
User avatar

Joined: Jul 14, 2010
Posts: 697
MareroQ wrote:
Question about the next version
Will this be possible?


Done!

I've got a few in but commented out:
  ["XNView", "\"C:\\Program Files\\XnView\\xnview.exe\""],
  ["MS Paint", "\"C:\\WINDOWS\\system32\\mspaint.exe\""],
  #["Deep Paint", "\"C:\\Program Files\\DeepPaint\\deeppaint.exe\""],
  #["Inkscape", "\"C:\\Program Files\\Inkscape\\inkscape.exe\""],
  #["PaintDOTNet", "\"C:\\Program Files\\Paint.NET\\PaintDotNet.exe\""],


Feel free to post up more here.

I've uploaded it as a zip since I can't upload a python file.
See this post for the latest version: viewtopic.php?f=9&t=970&p=17957#p17957

-Rob A>

_________________
Image
Fantasy Cartography and Mapping by RobA


Last edited by RobA on Tue Apr 05, 2011 2:57 pm, edited 1 time in total.

Top
 Post subject: Re: XNViewShell - and other Programs you can call with Gimp
PostPosted: Tue Feb 08, 2011 11:48 pm  (#112) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12516
Excellent Rob. Just tried it with both XNView and Inkscape. What a cool way to add capabilities to GIMP. The world is GIMP's oyster with this python plugin. I wonder if it could be done in Script-fu (probably not). If so, it should be part of any future GIMP update. If not, then they should go ahead and automatically force python as part of GIMP so this plugin can be made an integral part of GIMP. Thanks again Rob. :)

_________________
Lyle

Psalm 109:8

Image


Top
 Post subject: Re: XNViewShell - and other Programs you can call with Gimp
PostPosted: Wed Feb 09, 2011 12:11 am  (#113) 
Offline
Global Moderator
User avatar

Joined: Oct 06, 2010
Posts: 4045
Whoa, awesome stuff Rob! My question is since I am using this script primarily in Ubuntu, would there need to be a different call method for my version to include this shell out addition?

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


Top
 Post subject: Re: XNViewShell - and other Programs you can call with Gimp
PostPosted: Wed Feb 09, 2011 4:45 am  (#114) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Fantastic! 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 - and other Programs you can call with Gimp
PostPosted: Wed Feb 09, 2011 7:18 am  (#115) 
Offline
Script Coder
User avatar

Joined: Jul 14, 2010
Posts: 697
mahvin wrote:
Whoa, awesome stuff Rob! My question is since I am using this script primarily in Ubuntu, would there need to be a different call method for my version to include this shell out addition?


You need to specify the correct commands.

If you are calling other linux programs then it should be trivial. If you are calling things under wine modification would be required.

The one example earlier in the thread should show what is needed to do that, I think.

-Rob A>

_________________
Image
Fantasy Cartography and Mapping by RobA


Top
 Post subject: Re: XNViewShell - and other Programs you can call with Gimp
PostPosted: Wed Feb 09, 2011 12:04 pm  (#116) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Everything works great in XP by the way! :)
Awesome addition to GIMP Rob.
I agree this should be a add on to Gimps master in my opinion.
Some kind of exe plug-in that you can add and save preset calls.

_________________
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 - and other Programs you can call with Gimp
PostPosted: Wed Feb 09, 2011 9:51 pm  (#117) 
Offline
GimpChat Member
User avatar

Joined: Jul 04, 2010
Posts: 2253
Location: Retired Moderator Slowly Returning to the Living.
This is what I have working in Win 7! This is the sign of an awesome script! It's amazing anything works in 7, but all of the ones listed are working on mine!


Attachments:
Shellout.jpg
Shellout.jpg [ 47.27 KiB | Viewed 4035 times ]

_________________
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 - and other Programs you can call with Gimp
PostPosted: Thu Feb 10, 2011 7:53 am  (#118) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Superb!

_________________
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 - and other Programs you can call with Gimp
PostPosted: Thu Feb 10, 2011 9:13 am  (#119) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5870
That look really cool
i want try to replace MS paint with DAP

_________________
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 - and other Programs you can call with Gimp
PostPosted: Thu Feb 10, 2011 9:36 am  (#120) 
Offline
GimpChat Member
User avatar

Joined: Jul 04, 2010
Posts: 2253
Location: Retired Moderator Slowly Returning to the Living.
I kept MS Paint and added the extras that I wanted. Also, because my computer is running Win 7, PaintDotNET was in the "Program Files" path and MS Paint was in "Windows\system32" path. All of the others are in the "Program Files (x86)" path, because they are 32 bit programs.

_________________
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 new topic Reply to topic  [ 295 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7, 8, 9 ... 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