Thu Feb 17, 2011 3:32 pm
Thu Feb 17, 2011 3:39 pm
potrace -r 72 -t .2 -x 1 -a 0.85 -s %1Thu Feb 17, 2011 4:23 pm
Thu Feb 17, 2011 4:57 pm
AUTOTRACE -corner-threshold 75 -despeckle-level 16 -despeckle-tightness 2 -output-format svg -output-file %1+a.svg -report-progress %1Thu Feb 17, 2011 5:27 pm
Thu Feb 17, 2011 6:09 pm


Thu Feb 17, 2011 7:46 pm
Thu Feb 17, 2011 8:29 pm
Thu Feb 17, 2011 10:36 pm
Thu Feb 17, 2011 11:15 pm
Thu Feb 17, 2011 11:21 pm
Thu Feb 17, 2011 11:28 pm
Thu Feb 17, 2011 11:55 pm
Fri Feb 18, 2011 8:56 am
Fri Feb 18, 2011 12:01 pm
Tue Apr 05, 2011 12:58 pm
lylejk wrote:Here's a batch file that I created to use with Potrace; just copy it in your Potrace directory (save it as pt.bat if you like). Your bitmap has to be a BMP file (not PNG, or anything else; well, it could be a pgm, pbm, or ppm too). Just copy a shortcut to your desktop and then drag a bitmap file on top of it and release. You will get an SVG result to use whereever you want to use it in.
- Code:
potrace -r 72 -t .2 -x 1 -a 0.85 -s %1
Tue Apr 05, 2011 1:17 pm
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
call an external program passing the active layer as a temp file. Windows Only
Author:
Rob Antonishen
Version:
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):
programlist = [
["Autotrace", "\"C:\\Program Files\\Autotrace\\autotrace_lyle.bat\""], #<<<-----SET ME<<<----- (Directory where you place your bat)
["Potrace", "\"C:\\Program Files\\Potrace\\potrace_lyle.bat\"", "bmp"], #<<<-----SET ME<<<----- (Directory where you place your bat)
["",""]
]
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, command):
pdb.gimp_image_undo_group_start(image)
temp = pdb.gimp_image_get_active_drawable(image)
buffer = pdb.gimp_edit_named_copy(temp, "ShellTemp")
#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("bmp")
#tempfilename = os.path.join(tempfile.gettempdir(), "SheTempFile.bmp")
# !!! Note no run-mode first parameter, and user entered filename is empty string
pdb.gimp_progress_set_text ("Saving a copy")
pdb.file_bmp_save(tempimage, tempdrawable, tempfilename, tempfilename)
# Command line - Change to match where you installed XnView
progtorun = listcommands(command)
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()
#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_shelloutsvg",
"Save as SVG in Gimp/tmp directory",
"Call an Trace program",
"Rob Antonishen",
"Copyright 2011 Rob Antonishen",
"2011",
"<Image>/File/Eksport image as svg...",
"RGB*, GRAY*",
[ (PF_OPTION,"command",("Program:"),0,listcommands())
],
[],
plugin_main,
)
main()Fri May 06, 2011 3:23 pm
Fri May 06, 2011 8:26 pm