It is currently Wed May 15, 2024 5:31 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 35 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: ZebraTrace
PostPosted: Wed Dec 11, 2013 5:29 am  (#1) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12521
Ran across this cool program for creating vector traces of bitmaps. Makes for some cool guilloche results. :)

http://libregraphicsworld.org/blog/entry/zebratrace-0-5


Attachments:
DSC00422crp.png
DSC00422crp.png [ 503.81 KiB | Viewed 5088 times ]

_________________
Lyle

Psalm 109:8

Image
Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: ZebraTrace
PostPosted: Wed Dec 11, 2013 9:54 am  (#2) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Nice find Lyle. Thanks for posting the link. :)
Reminds me of Alphas Engraver.

_________________
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: ZebraTrace
PostPosted: Wed Dec 11, 2013 9:55 am  (#3) 
Offline
Global Moderator
User avatar

Joined: Apr 07, 2010
Posts: 14182
Your dad will like that one Lyle.

_________________
Image


Top
 Post subject: Re: ZebraTrace
PostPosted: Wed Dec 11, 2013 10:28 am  (#4) 
Offline
GimpChat Member
User avatar

Joined: Aug 16, 2012
Posts: 4271
Location: Göteborg, Sweden
lylejk: that's nice looking! i liked the possibility to use waved lines instead of straight ones, i've always like engravings with waved lines.

_________________


Top
 Post subject: Re: ZebraTrace
PostPosted: Wed Dec 11, 2013 1:10 pm  (#5) 
Offline
GimpChat Member
User avatar

Joined: Feb 14, 2012
Posts: 426
You can get that kind of line effect right in Gimp.

I took a photo.

Image

Created a layer above it and did a Render Pattern Grid filter followed by Distorts Ripple and a little blur to get this.

Image

And then turned this top layer mode to Dodge Mode.

Image

By playing with the Curves on either layer you can achieve many different effects but the concept is simple.

Pegleg


Top
 Post subject: Re: ZebraTrace
PostPosted: Wed Dec 11, 2013 1:19 pm  (#6) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12521
There's a difference Pegleg. The program is all black or white and not levels of gray like your method implements. The apparent contrast is accomplished by varying the width of the lines. :)

_________________
Lyle

Psalm 109:8

Image


Top
 Post subject: Re: ZebraTrace
PostPosted: Wed Dec 11, 2013 2:12 pm  (#7) 
Offline
GimpChat Member
User avatar

Joined: Feb 14, 2012
Posts: 426
Hi Lyle

If you do it in higher resolution and then use threashold you can get it close.

This is more black and white but still low res. I scaled it up x4 did the threashold and then scaled back down.

Image

Alan


Top
 Post subject: Re: ZebraTrace
PostPosted: Wed Dec 11, 2013 4:58 pm  (#8) 
Offline
GimpChat Member

Joined: May 09, 2012
Posts: 914
:tyspin Lylejk

A first test :


Attachments:
ZebraTraces.png
ZebraTraces.png [ 39.48 KiB | Viewed 4962 times ]
Top
 Post subject: Re: ZebraTrace
PostPosted: Mon Nov 17, 2014 8:08 am  (#9) 
Offline
Global Moderator
User avatar

Joined: Apr 01, 2012
Posts: 7730
Location: On the other side of this screen
Cool :bigthup

_________________


Top
 Post subject: Re: ZebraTrace
PostPosted: Mon Nov 17, 2014 9:38 am  (#10) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
by googling, I found that ZebraTrace is a program (free) written in Python, whose source is available.
Is there a nice python guru here around who can take that source and convert it into a gimp_python filter?
It would be nice...
Who knows...

_________________
"Where am I ?"


Top
 Post subject: Re: ZebraTrace
PostPosted: Mon Nov 17, 2014 10:57 am  (#11) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
dinasset wrote:
by googling, I found that ZebraTrace is a program (free) written in Python, whose source is available.
Is there a nice python guru here around who can take that source and convert it into a gimp_python filter?
It would be nice...
Who knows...


Easy enough to just run the program through Shellout. :)

Image

It only saves as a SVG or vector file.So make sure and add the code like this or as your directory tree to the program would be written (depending on your platform of Windows).
  ["Zebra Trace", "\"C:\\Program Files (x86)\\ZebraTRACE\\ZebraTrace.exe\"", "svg"],


Image
This is the file that will be created and exported back to GIMP as a new layer.The temp SVG file will be deleted.
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: ZebraTrace
PostPosted: Mon Nov 17, 2014 2:24 pm  (#12) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12521
ref: http://www.fontplay.com/freephotos/seve ... 107-03.jpg

Glad this cool utility is making a comeback so to speak. Decided to blend a few layers of different ZT outputs for this result. Might edit my shellout to work with ZT Rod but too lazy right now. lol

:)


Attachments:
output2.png
output2.png [ 703.81 KiB | Viewed 2142 times ]

_________________
Lyle

Psalm 109:8

Image
Top
 Post subject: Re: ZebraTrace
PostPosted: Mon Nov 17, 2014 3:02 pm  (#13) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
@Rod
thanks!
I added the line you kindly provided, thus I see the new program in ShellOut, but when I click gimp says "unknown file type".
What should I add into Gimp? is there a "save as svg" piece to be added?

edit: I have SVG Export installed and showing under Utils...

edit2: maybe the base image from which ShellOut is called must be itself an svg file?
in this case it's useless...

edit3: I should remove the hypothesis I made on edit2: the same image directly opened in Zebra (i.,e. not going thru Gimp>Shellout) is processed appropriately
thus there must be something missing in my gimp

_________________
"Where am I ?"


Top
 Post subject: Re: ZebraTrace
PostPosted: Tue Nov 18, 2014 7:05 am  (#14) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
dinasset wrote:
@Rod
thanks!
I added the line you kindly provided, thus I see the new program in ShellOut, but when I click gimp says "unknown file type".
What should I add into Gimp? is there a "save as svg" piece to be added?

edit: I have SVG Export installed and showing under Utils...

edit2: maybe the base image from which ShellOut is called must be itself an svg file?
in this case it's useless...

edit3: I should remove the hypothesis I made on edit2: the same image directly opened in Zebra (i.,e. not going thru Gimp>Shellout) is processed appropriately
thus there must be something missing in my gimp

Did you install the newest shellout.py version? This must be in the code for the command line to run and to get the correct file type.
  #get the program to run and filetype.
  progtorun = listcommands(command)


This was something Rob A added for Lyle and i to run different image extension other than PNG. At least i think that is the added code line. :lol GIMP-2.8.10 or newer GIMP-2.8.14 both should run SVG out of the box. As i stated before the temp is saved as a SVG and imported back into GIMP but it is NOT a svg or PATH layer. It's just a regular RGB layer. :) The temp svg file is then discarded.

By the way any image should work. svg at the end of the line code tells the Zebra Trace program (lies to it ) that it is a temp.svg file and can be re saved as such.

_________________
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: ZebraTrace
PostPosted: Tue Nov 18, 2014 7:21 am  (#15) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
Rod, that line is in my version of Shellout
on the top it says it's version 0.7
is it ok?

_________________
"Where am I ?"


Top
 Post subject: Re: ZebraTrace
PostPosted: Tue Nov 18, 2014 8:01 am  (#16) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
(addendum)
to make a re-test:
- redownloaded shellout.py from the registry and moved into the folder
- edited adding the line you suggested
- cleared gimprc and pluginrc
- restarted gimp
- checked the newly downloaded shellout was called (in the previous I had a different list of programs to call): OK
- selected ZEBRA
- .... same error

I put here the image of my desktop at error time
Attachment:
Ashampoo_Snap_2014.11.18_13h55m32s_001_.png
Ashampoo_Snap_2014.11.18_13h55m32s_001_.png [ 1.79 MiB | Viewed 2116 times ]


it seems the error comes from pdb.gimp_file_save
hence I come back to my original question
is there something I have to add to Gimp file management?

_________________
"Where am I ?"


Top
 Post subject: Re: ZebraTrace
PostPosted: Wed Nov 19, 2014 7:03 am  (#17) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
dinasset wrote:
(addendum)
to make a re-test:
- redownloaded shellout.py from the registry and moved into the folder
- edited adding the line you suggested
- cleared gimprc and pluginrc
- restarted gimp
- checked the newly downloaded shellout was called (in the previous I had a different list of programs to call): OK
- selected ZEBRA
- .... same error

I put here the image of my desktop at error time
Attachment:
Ashampoo_Snap_2014.11.18_13h55m32s_001_.png


it seems the error comes from pdb.gimp_file_save
hence I come back to my original question
is there something I have to add to Gimp file management?

Try and change svg in that line of code to png and see what happens.I am not certain of the reason it errors. Perhaps Rob A can shed some light. Try and PM him. It worked for me after changing the extension to svg.

_________________
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: ZebraTrace
PostPosted: Wed Nov 19, 2014 10:21 am  (#18) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
Rod, these are my last news:
a) to continue testing without any kind of impact on my installed gimp (if any) I downloaded and installed the last version of Gimp Portable (2.8.14)
b) copied inside the plug-in folder of that one the "shellout.py"
c) tried again w/o any change: same result as in standard Gimp
d) changed "svg" into "png": ZebraTrace starts (very good!)
e) choosen my options in Zebra then clicken on "save" (ZT wanted a name: given)
f) exited ZT
g) the return to Gimp didn't show the "traced" layer
h) thus opened the temp file (whose name I took a note)
i) ok, it's the traced file (as if created by ZT standalone)
j) hence, my more specific question ( if you have the patience to read me again)

1-you wrote This is the file that will be created and exported back to GIMP as a new layer.The temp SVG file will be deleted.
did you mean that the interface performed that or the user (me) should do what I did: go to the temp archive and open myself the traced layer?
in the first case, the interface I have does not perform its task
2-could you attach here zipped the shellout you are using to do a comparison with the one I have?


thanks a lot again


edit: I PM'ed to RobA asking whether he wants to read this topic

_________________
"Where am I ?"


Top
 Post subject: Re: ZebraTrace
PostPosted: Wed Nov 19, 2014 10:43 am  (#19) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
dinasset wrote:
Rod, these are my last news:
a) to continue testing without any kind of impact on my installed gimp (if any) I downloaded and installed the last version of Gimp Portable (2.8.14)
b) copied inside the plug-in folder of that one the "shellout.py"
c) tried again w/o any change: same result as in standard Gimp
d) changed "svg" into "png": ZebraTrace starts (very good!)
e) choosen my options in Zebra then clicken on "save" (ZT wanted a name: given)
f) exited ZT
g) the return to Gimp didn't show the "traced" layer
h) thus opened the temp file (whose name I took a note)
i) ok, it's the traced file (as if created by ZT standalone)
j) hence, my more specific question ( if you have the patience to read me again)

1-you wrote This is the file that will be created and exported back to GIMP as a new layer.The temp SVG file will be deleted.
did you mean that the interface performed that or the user (me) should do what I did: go to the temp archive and open myself the traced layer?
in the first case, the interface I have does not perform its task
2-could you attach here zipped the shellout you are using to do a comparison with the one I have?


thanks a lot again


edit: I PM'ed to RobA asking whether he wants to read this topic

This is exactly why i renamed png to svg.
When GIMP (Shellout) opens the ZebraTrace program Zebra wants to re save after you do your editing to a svg file. IF the temp file is already a svg (which Shellout saves it as if it is svg and not png) then ZebraTrace will send it back as a new top layer then Shellout deletes the svg temp file.You should not have to name the file when you save in ZebraTrace. It should save and send back to GIMP automagically. :)
This is how it SHOULD work if you have added the line of code i provided. This is why i suggested to contact Rob A. because something isn't right. You need to figure out how to save the temp file to a svg extension. Can you paste your shellout.py code for me here please?

_________________
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: ZebraTrace
PostPosted: Wed Nov 19, 2014 11:05 am  (#20) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
OK, here it is (last version after modifying "svg" with "png" as you suggested)
!/usr/bin/env python

'''
ShellOut.py
call an external program passing the active layer as a temp file.  Windows Only(?)

Author:
Rob Antonishen

Version:
0.7 fixed file save bug where all files were png regardless of extension
0.6 modified to allow for a returned layer that is a different size
   than the saved layer for
  0.5 file extension parameter in program list.
0.4 modified to support many optional programs.

this script is modelled after the mm extern LabCurves trace plugin
by Michael Munzert http://www.mm-log.com/lab-curves-gimp

and thanks to the folds at gimp-chat has grown a bit ;)

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

#program list function (globals are evil)
def listcommands(option=None):
  #
  # Insert additonal shell command into this list.  They will show up in the drop menu in this order.
  # Use the syntax:
  # ["Menu Label", "command", "ext"]
  #
  # Where what gets executed is command fileame so include and flags needed in the command.
  programlist = [
  ["XNView", "\"C:\\PF\\XnView\\xnview.exe\"", "png"],
  ["MS Paint", "\"..\\..\\..\\..\\WINDOWS\\system32\\mspaint.exe\"", "bmp"],
  ["InPaint", "\"C:\\PF\\Inpaint\\Inpaint.exe\"", "png"],
  #["Deep Paint", "\"C:\\Program Files\\DeepPaint\\deeppaint.exe\"", "jpg"],
  #["Inkscape", "\"C:\\Program Files\\Inkscape\\inkscape.exe\"", "png"],
  #["PaintDOTNet", "\"C:\\Program Files\\Paint.NET\\PaintDotNet.exe\"", "png"],
  #["MyPaint", "\"C:\\Program Files\\MyPaint\\mypaint.exe\"", "png"],
  #["Photo Filter Factory", "\"C:\\Program Files\\Photo Filter Factory\\Photo Filter Factory.exe\"", "png"],
  #["Photo Pos Pro", "\"C:\\Program Files\\Photo Pos Pro\\Photo Pos Pro.exe\"", "png"],
  ["Java Image Editor", "\"C:\\JavaJars\\imageeditor.bat\"", "png"],
  ["Java Mosaic", "\"C:\\JavaJars\\mosaic.bat\"", "png"],
  ["JDraw", "\"C:\\JavaJars\\jdraw.bat\"", "png"],
  #["Vector Magic", "\"C:\\Program Files\\Vector Magic\\vmde.exe\"", "png"],
  #["Photo Clinic", "\"C:\\MAGIX\\Photo_Clinic_45\\PhotoClinic.exe\"", "png"],
  ["Smilla Enlarger", "\"C:\\utils\\SmillaEnlarger\\SmillaEnlarger.exe\"", "png"],
  ["Zebra Trace", "\"C:\\Program Files\\ZebraTRACE\\ZebraTrace.exe\"", "png"],
  ["","",""]
  ]
 
  if option == None: # no parameter return menu list, otherwise return the appropaiate array
    menulist = []
    for i in programlist:
      if i[0] != "":
        menulist.append(i[0])
    return menulist
  else:
    return programlist[option]
   

def plugin_main(image, drawable, visible, command):
  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, "ShellOutTemp")

  #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)
 
  #get the program to run and filetype.
  progtorun = listcommands(command)
 
  # 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(progtorun[2])
  tempfilename = os.path.join(tempfile.gettempdir(), "ShellOutTempFile."+progtorun[2])
 

  # !!! Note no run-mode first parameter, and user entered filename is empty string
  pdb.gimp_progress_set_text ("Saving a copy")
  pdb.gimp_file_save(tempimage, tempdrawable, tempfilename, tempfilename)

  # Build command line call
  command = progtorun[1] + " \"" + tempfilename + "\""
  args = shlex.split(command)

  # Invoke external command
  pdb.gimp_progress_set_text ("calling " + progtorun[0] + "...")
  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, "ShellOutTemp")

  if visible == 0:
    drawable.resize(newlayer2.width,newlayer2.height,0,0)
    sel = pdb.gimp_edit_named_paste(drawable, buffer, 1)
    drawable.translate((tempdrawable.width-newlayer2.width)/2,(tempdrawable.height-newlayer2.height)/2)
  else:
    temp.resize(newlayer2.width,newlayer2.height,0,0)
    sel = pdb.gimp_edit_named_paste(temp, buffer, 1)
    temp.translate((tempdrawable.width-newlayer2.width)/2,(tempdrawable.height-newlayer2.height)/2)

  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_shellout",
        "Call an external program",
        "Call an external program",
        "Rob Antonishen",
        "Copyright 2011 Rob Antonishen",
        "2011",
        "<Image>/Filters/ShellOut...",
        "RGB*, GRAY*",
        [ (PF_RADIO, "visible", "Layer:", 1, (("new from visible", 1),("current layer",0))),
          (PF_OPTION,"command",("Program:"),0,listcommands())
        ],
        [],
        plugin_main,
        )

main()

_________________
"Where am I ?"


Top
Post new topic Reply to topic  [ 35 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours [ DST ]



* Login  



Powered by phpBB3 © phpBB Group