Difference between revisions of "Mkui"

From Organic Design wiki
({{perl}})
m
 
Line 1: Line 1:
 +
{{legacy}}
 +
<source lang="perl">
 
#!/usr/bin/perl -w
 
#!/usr/bin/perl -w
# process a directory of svg files into png files{{perl}}
+
# process a directory of svg files into png files
 
# using image magick
 
# using image magick
  
Line 32: Line 34:
 
warn $x if $x;
 
warn $x if $x;
 
}
 
}
 +
</source>
 +
[[Category:PERL]]

Latest revision as of 03:06, 23 April 2020

Legacy.svg Legacy: This article describes a concept that has been superseded in the course of ongoing development on the Organic Design wiki. Please do not develop this any further or base work on this concept, this is only useful for a historic record of work done. You may find a link to the currently used concept or function in this article, if not you can contact the author to find out what has taken the place of this legacy item.
#!/usr/bin/perl -w
# process a directory of svg files into png files
# 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;
}