Difference between revisions of "Mkui"

From Organic Design wiki
 
({{perl}})
Line 1: Line 1:
 
#!/usr/bin/perl -w
 
#!/usr/bin/perl -w
# process a directory of svg files into png files
+
# process a directory of svg files into png files{{perl}}
 
# using image magick
 
# using image magick
  

Revision as of 01:19, 13 July 2008

  1. !/usr/bin/perl -w
  2. process a directory of svg files into png filesOur Perl scripts.
  3. using image magick

use strict; use Image::Magick;

my $ROOT = `pwd`; chomp $ROOT;

opendir(DIR, "$ROOT/src/ui/svg") or die "Can't open UI folder: $!"; while ( my $file = readdir(DIR) ) { # process only svg files next unless $file =~ /\.svg$/;

my $image = Image::Magick->new( #matte => 'True', #colorspace => 'RGB', #type => 'TrueColor', #size => '1024x768', background => 'none', );

$file =~ m/(.*)\.svg$/;

my $svg = "$ROOT/src/ui/svg/$1.svg"; my $png = "$ROOT/src/ui/png/$1.png";

my $x = $image->Read( filename => $svg ); warn "$x $svg" if $x; $x = $image->Write( filename => $png, matte => 'true' ); warn $x if $x; }