It is currently Mon Mar 18, 2024 9:49 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, 6, 7, 8 ... 15  Next
Author Message
 Post subject: Re: XNViewShell
PostPosted: Fri Jan 21, 2011 1:51 pm  (#81) 
Offline
GimpChat Member
User avatar

Joined: Jul 04, 2010
Posts: 2253
Location: Retired Moderator Slowly Returning to the Living.
It does everything it's supposed to do, except return the image. It says it saved but Gimp never sees it.

_________________
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 21, 2011 2:06 pm  (#82) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2231
Location: Poland
Sorry for my english- still learning - but scroll Irfan 3.png in Ubuntu, however, suggests that such

_________________
Image

Slava
Ukraini!


Top
 Post subject: Re: XNViewShell
PostPosted: Fri Jan 21, 2011 3:22 pm  (#83) 
Offline
GimpChat Member
User avatar

Joined: Jul 04, 2010
Posts: 2253
Location: Retired Moderator Slowly Returning to the Living.
It appears that the Irfanview script, and Irfanview, saves the resulting image but Gimp isn't loading it. I did a line by line comparison of the XnView script and the Irfanview script and they are the same except for the path and program name. I am confuuuuused.

_________________
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 21, 2011 4:37 pm  (#84) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2231
Location: Poland
I did the same thing but I had a mechanical errors when:

the path and program name:

in Windows:

command = "\"C:\\Program Files\\IrfanView\\Irfanview.exe\" \"" + tempfilename + "\"" - no

command = "\"C:\\Program Files\\IrfanView\\i_view32.exe\" \"" + tempfilename + "\"" - yes

In IrfanView:

Save as - no
Save (original folder) - yes

And nothing more to work ... each computer is different ?

_________________
Image

Slava
Ukraini!


Top
 Post subject: Re: XNViewShell
PostPosted: Thu Feb 03, 2011 4:54 pm  (#85) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2231
Location: Poland
In Linux works great plugin plugin-trace.py (in Windows for me, broken)
http://registry.gimp.org/node/21349
Png files using XNViewShell can be processed in Inkscape (Shell_Inkscape in annexes)
Does anyone know if how to export (using xnviewshel) svg from Gimp to Inkscape?


Attachments:
Gimp-Inkscape 1.png
Gimp-Inkscape 1.png [ 711.79 KiB | Viewed 2136 times ]
Gimp-Inkscape 3.png
Gimp-Inkscape 3.png [ 466.71 KiB | Viewed 2136 times ]
Gimp-Inkscape.zip [3.89 KiB]
Downloaded 110 times

_________________
Image

Slava
Ukraini!
Top
 Post subject: Re: XNViewShell
PostPosted: Thu Feb 03, 2011 8:54 pm  (#86) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12509
When I went from WinXP to Win7 64-bit, Autotrace no longer worked (still works in my XP VM though). I have no idea why it doesn't work. Potrace still does work though. They have not updated Autotrace for a long time, and am not holding my breath that they will. :)

_________________
Lyle

Psalm 109:8

Image


Top
 Post subject: Re: XNViewShell
PostPosted: Thu Feb 03, 2011 9:12 pm  (#87) 
Offline
GimpChat Member
User avatar

Joined: Jul 04, 2010
Posts: 2253
Location: Retired Moderator Slowly Returning to the Living.
MareroQ wrote:
command = "\"C:\\Program Files\\IrfanView\\Irfanview.exe\" \"" + tempfilename + "\"" - no

command = "\"C:\\Program Files\\IrfanView\\i_view32.exe\" \"" + tempfilename + "\"" - yes

These command lines return the following errors.

Global name no is not defined
Global name yes is not defined

_________________
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 Feb 04, 2011 2:45 am  (#88) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
I got Deep Paint and XnView to run together in the Plug-ins folder.
I'll give Inkscape a try, and get back to you.

_________________
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: Fri Feb 04, 2011 3:11 am  (#89) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Think this will do it.
Copy and paste in notepad ++ or an text editor then name it - InkscapeShell.py -
then place it in your Plug-ins folder.

You will find it under Filters/Call/Inkscape

#!/usr/bin/env python

'''
InkscapeShell.py
call Inkscape to allow tracing or further editing in vector.  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, "InkscapeShellTemp")

  #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\\Inkscape\\inkscape.exe\" \"" + tempfilename + "\""
  args = shlex.split(command)

  # Invoke external command
  pdb.gimp_progress_set_text ("run Inkscape...")
  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, "InkscapeShellTemp")

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

main()


Yup works for me. :)
Image

_________________
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: Fri Feb 04, 2011 3:21 am  (#90) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Yes to be sure it worked i created a small red vector square on the gimp temp image
Be sure and save as svg it will revert back to a jpg or whatever format it was.
Also be sure and save it as the exact name you opened it in Inkscape as. (same ending number)
Image: after export back to Gimp
Image

_________________
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: Fri Feb 04, 2011 6:56 am  (#91) 
Offline
GimpChat Member
User avatar

Joined: Jul 04, 2010
Posts: 2253
Location: Retired Moderator Slowly Returning to the Living.
I set up the path for Inkscape on Win7. I ran Filters > Call > Inkscape and the script came up, but when I went to run it I got this error. (I expanded it for detail)
I even tried it with Inkscape running, and got the same error. The scripts don't seem to like Win7 I guess.

EDIT: I tried changing line 83 from shell=False to shell=True and the error went away, but Inkscape still never launched.


Attachments:
Inksacpe Error.jpg
Inksacpe Error.jpg [ 139.97 KiB | Viewed 1886 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
PostPosted: Fri Feb 04, 2011 9:22 am  (#92) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
PM have you tried setting a path variable to your C:/Program Files/Gimp-2.0/lib/gimp/2.0/plug-ins folder?
Try adding it to your path, that may work.
Looks like windows is trying to find the file, and can not locate it.

It should work for anyone using Windows XP 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: Fri Feb 04, 2011 11:14 am  (#93) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2231
Location: Poland
My problem to solve is the question whether it is possible to use the call to operating on svg files (not png)

how to replace:

pdb.file_png_save_defaults(tempimage, tempdrawable, tempfilename, tempfilename)

and what procedure ?

pdb.gimp_vectors_export_to_file ?
pdb.gimp_vectors_import_from_file ?

_________________
Image

Slava
Ukraini!


Top
 Post subject: Re: XNViewShell
PostPosted: Fri Feb 04, 2011 12:10 pm  (#94) 
Offline
Script Coder
User avatar

Joined: Jul 14, 2010
Posts: 697
MareroQ wrote:
My problem to solve is the question whether it is possible to use the call to operating on svg files (not png)

how to replace:

pdb.file_png_save_defaults(tempimage, tempdrawable, tempfilename, tempfilename)

and what procedure ?

pdb.gimp_vectors_export_to_file ?
pdb.gimp_vectors_import_from_file ?


You cant save a layer as SVG. You can only save paths (using the calls you mentioned). The whole thing would need to be changed to do that.

-Rob A>

_________________
Image
Fantasy Cartography and Mapping by RobA


Top
 Post subject: Re: XNViewShell
PostPosted: Fri Feb 04, 2011 2:23 pm  (#95) 
Offline
GimpChat Member
User avatar

Joined: Jul 04, 2010
Posts: 2253
Location: Retired Moderator Slowly Returning to the Living.
I think my problems are a Win 7 problem. Some plugins don't work in Irfanview, XnView, Gimp or anything else I have tried. Also some of the python scripts don't work in Win 7.

On the py-scripts I have been changing the path from "Program Files" to "Program Files (x86)" since all my graphics programs are running 32bit and are there instead. It really sucks that Win 7 has so many problems with "everything"!

_________________
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 Feb 04, 2011 3:35 pm  (#96) 
Offline
Global Moderator
User avatar

Joined: Apr 07, 2010
Posts: 14182
I heard all kinds of horror stories about windows 7 and I haven't run into any of them yet. Python and G"mic installed the first try and everything else is running SWEETLY, so far. I love the Snipping tool. I use it a lot...

_________________
Image


Top
 Post subject: Re: XNViewShell
PostPosted: Fri Feb 04, 2011 4:03 pm  (#97) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2231
Location: Poland
For sure it was ever presented

http://www.anamorphosis.com/software.html

... but that's another story XNViewShell...

PS. We call for the use of different programs - may be able to build a python drop-down list box - which program to open?

_________________
Image

Slava
Ukraini!


Last edited by MareroQ on Sat Feb 05, 2011 7:35 am, edited 1 time in total.

Top
 Post subject: Re: XNViewShell
PostPosted: Fri Feb 04, 2011 4:08 pm  (#98) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12509
Now that's a cool idea MareoQ. Using this shell caller, it really does expand GIMP's capabilities for sure. Could be a cool way to marry 3D (use GIMP to transer a texture and 3D app sends back a render), Vector (what else, Inkscape), and photoshop filters to boot. Personally, I wish Inkscape and GIMP were combined into one app anyway, but maybe I request too much. :)

_________________
Lyle

Psalm 109:8

Image


Top
 Post subject: Re: XNViewShell
PostPosted: Sat Feb 05, 2011 3:06 am  (#99) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Quote:
I wish Inkscape and GIMP were combined into one app anyway, but maybe I request too much


That would be a wonderful day. :)

_________________
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 Feb 05, 2011 3:37 am  (#100) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
MareroQ wrote:
For sure it was ever presented

http://www.anamorphosis.com/software.html

... but that's another story XNViewShell...

PS. We call for the use of different programs - may be able to build a python drop-down list box - which program to open?


It opens AnamorphMe fine and exports back fine, but it creates a re-named image after rendering so Gimp opens the actual default file with no changes.I tried renaming the file to the gimp temp default file but got an error.
If you want it to just call AnamorpheMe and save that renamed file, here is the code.
Just drop it in your text editor name it AnamorpheMeShell.py and place it in your plug-ins folder.
Found in Filters/Call/AnamorphMe

#!/usr/bin/env python

'''
AnamorphMeShell.py
call AnamorphMe to allow 3-D manipulation.  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, "AnamorphMeShellTemp")

  #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\\AnamorphMe\\AnamorphMe.exe\" \"" + tempfilename + "\""
  args = shlex.split(command)

  # Invoke external command
  pdb.gimp_progress_set_text ("run AnamorphMe...")
  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, "AnamorphMeShellTemp")

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

main()

_________________
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, 6, 7, 8 ... 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