m (Created page with "= svg2png = <tt>svg2png</tt> is a perl script to convert the svg files in the current directory into png images, doing the conversion only if the svg file is newer th...") |
(Update of my 2008 script!) |
||
Line 7: | Line 7: | ||
Simply run <tt>./svg2png</tt> in the working directory. | Simply run <tt>./svg2png</tt> in the working directory. | ||
− | == | + | On {{thisday|6|January|2024}}, {{I}} had to amend this [[2008]] script with the line |
+ | |||
+ | <pre> | ||
+ | print MyMakefile "\tinkscape -h 7200 -b white -o $file.png $file \n\n"; | ||
+ | </pre> | ||
+ | |||
+ | since the export option is not <tt>-e</tt> anymore but <tt>-o</tt>. I also added the <tt>-b=white</tt> option to force white background. This makes [[:File:svg2png.gz|version svg2png v°0.2]]. | ||
+ | |||
+ | == Versions: == | ||
+ | |||
+ | # v0°1: {{thisday|3|November|2008}}. | ||
+ | # '''[[:File:svg2png.gz|v0°2]]''': {{subs:today}} ― last version, not the one listed below! | ||
<pre> | <pre> |
svg2png is a perl script to convert the svg files in the current directory into png images, doing the conversion only if the svg file is newer than its corresponding png.
Simply run ./svg2png in the working directory.
On 6 January (2024), I had to amend this 2008 script with the line
print MyMakefile "\tinkscape -h 7200 -b white -o $file.png $file \n\n";
since the export option is not -e anymore but -o. I also added the -b=white option to force white background. This makes version svg2png v°0.2.
#! /usr/bin/perl # svg2png v0°1 ____ # _____ ____ _|___ \ _ __ _ __ __ _ #/ __\ \ / / _` | __) | '_ \| '_ \ / _` | #\__ \\ V / (_| |/ __/| |_) | | | | (_| | #|___/ \_/ \__, |_____| .__/|_| |_|\__, | # |___/ |_| |___/ # # F.P. Laussy - Mon Nov 3 15:05:54 GMT 2008 # F.P.Laussy@soton.ac.uk # Convert svg files of the current directory into high-quality png # Do this only if timestamp of svg is newer than its png # Bind all png together with -b option (into presentation.png) use Getopt::Std; getopts("b",\%options); @files = <*.svg>; # Build makefile my $pngfiles = ""; open (MyMakefile, '>Makefile'); foreach $file (@files) { $pngfiles .= "$file.png "; } print MyMakefile "presentation.png : $pngfiles"; if ($options{b}){ print MyMakefile "\n\tpdftk $pdffiles cat output presentation.pdf" } print MyMakefile "\n\n"; # dependencies @files = <*.svg>; foreach $file (@files) { print MyMakefile "$file.png : $file \n"; print MyMakefile "\tinkscape -h 7200 -e $file.png $file \n\n"; } close (MyMakefile); system("make"); #system("rm Makefile"); print "svg2png has finished!\n";