in reply to SVG manipulation

I played with your concept awhile back. I found autotrace.

Then I used the following script to convert.

Gtk2 also has SVG capabilities, see Gnome2::Rsvg

#!/usr/bin/perl use warnings; use strict; use Image::Magick; my $infile = $ARGV[0]; (my $filebase) = $infile =~ /(.*)\.(\w+)$/; my $p = new Image::Magick; $p->Read($infile); my $outbmp = $filebase.'.'.'bmp'; $p->Write($outbmp) or warn "@!"; my $fin = $outbmp; my $fout = $filebase.'.svg'; my @options = qw( --despeckle-level 8 --corner-always-threshold 60 --corner-surround 60 --tangent-surround 3 --color-count 256 --corner-threshold 100 --despeckle-tightness 2 --error-threshold 2 --filter-iterations 4 --line-reversion-threshold .01 --line-threshold 1 ); system ("./autotrace --output-format svg --output-file $fout @options + $fin"); __END__ adjColor = gtk.Adjustment(256, lower=0, upper=256, step_incr=1, page_i +ncr=0, page_size=0) adjColAlwThresh = gtk.Adjustment(60, lower=2, upper=180, step_incr=1, +page_incr=10, page_size=0) adjCornSur = gtk.Adjustment(60, lower=2, upper=180, step_incr=1, page_ +incr=20, page_size=0) adjCornTh = gtk.Adjustment(100, lower=2, upper=180, step_incr=1, page_ +incr=10, page_size=0) adjDespLev = gtk.Adjustment(8, lower=0, upper=20, step_incr=1, page_in +cr=0, page_size=0) adjDespTig = gtk.Adjustment(2, lower=0, upper=8, step_incr=0.1, page_i +ncr=1, page_size=0) adjErrThr = gtk.Adjustment(2, lower=.1, upper=10, step_incr=0.1, page_ +incr=1, page_size=0) adjFiltIt = gtk.Adjustment(4, lower=1, upper=16, step_incr=1, page_inc +r=0, page_size=0) adjLineRevThr = gtk.Adjustment(0.01, lower=0.01, upper=0.16, step_incr +=0.01, page_incr=1, page_size=0) adjLineThr = gtk.Adjustment(1, lower=1, upper=20, step_incr=1, page_in +cr=0, page_size=0) adjTangSur = gtk.Adjustment(3, lower=1, upper=16, step_incr=1, page_in +cr=0, page_size=0) adjNumCol = gtk.Adjustment(0, lower=0, upper=256, step_incr=1, page_in +cr=20, page_size=0)

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

Replies are listed 'Best First'.
Re^2: SVG manipulation
by martell (Hermit) on Apr 29, 2011 at 16:34 UTC

    Nice program. It is however not what i'm looking for.

    Maybe a little more explanation about my problem. Suppose I have in my database an application component with 6 business object and another application component with 3 business objects inside.

    I'm trying to generate an image that will display 2 application components. The first will be bigger and containing 2 rows of 3 business objects. The second will have 1 row of 3 business objects.

    To generate the image, I want to take a svg image representing the business object and copy it six times in on a grid. Next I will take the svg image representing the application component, stretch it so its boundaries are bigger then the grid of the six business objects and past the six objects inside.

    I hope the svg manipulation would simplify the construction of the drawing. To construct the image using png parts is possible but cumbersome and not easily maintainable if they suddenly want another symbol.

    Nevertheless the program you suggested is nice to know. At many other occasions I wished I had something like that. And now I have :)

    Kind regards

    Martell

      After reading what you are trying to do, my first thought is to use a Canvas type widget, since you are talking about resizing components. For instance, a Tk Canvas, and all other Canvas type widgets, will let you programmically draw and resize widgets, and the advanced Canvases will let you zoom, as in Tk::Zinc.

      Anyways, a Tk canvas will let you construct your custom gridwork, fill it in with appropriately scaled fonts, and export the whole thing as a pdf. See Tk Patio/Office layout designer for example.

      However, if this is running on a server, Canvases need an X server, so it may not be useful to you.


      I'm not really a human, but I play one on earth.
      Old Perl Programmer Haiku ................... flash japh