#!/usr/bin/perl
use strict;

# Arg 1: path to file 1
# Arg 2: path to file 2
# Arg 3: path to output file
sub make_montage
{
    my $first_file = shift;
    my $second_file = shift;
    my $output_file = shift;

    system("montage -background '#31363b' $first_file $second_file $output_file");
}

while (<>) {
    chomp;
    my $first_file = $_;
    $first_file =~ s/[0-9.]+ //;

    my $second_file = $first_file;
    $second_file =~ s/icons-dark_original/icons-dark_generated/;

    my $output_file = $first_file;
    $output_file =~ s{/}{_}g;
    $output_file =~ s{icons-dark_original}{montages/};
    $output_file =~ s{__}{};
    $output_file =~ s{.svg}{.png};

    print "Making montage $output_file\n";
    &make_montage($first_file, $second_file, $output_file);
}
