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°3 ____ # _____ ____ _|___ \ _ __ _ __ __ _ #/ __\ \ / / _` | __) | '_ \| '_ \ / _` | #\__ \\ V / (_| |/ __/| |_) | | | | (_| | #|___/ \_/ \__, |_____| .__/|_| |_|\__, | # |___/ |_| |___/ # # F.P. Laussy - Wed Feb 5 CET 2025 # [email protected] # 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) { my $pngfile = $file; $pngfile =~ s/\.svg//g; $pngfiles .= "$pngfile.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) { my $pngfile = $file; $pngfile =~ s/\.svg//g; print MyMakefile "$pngfile.png : $pngfile.svg \n"; print MyMakefile "\tinkscape -h 7200 -b white -o $pngfile.png $pngfile.svg \n\n"; } close (MyMakefile); system("make"); #system("rm Makefile"); print "svg2png has finished!\n";