#!/usr/bin/env perl # Demotivator generator by Antoine Amarilli (2011) # License: public domain. if ($#ARGV != 3) { print "mkdemotiv -- automatical demotivator generation\n"; print "usage: mkdemotiv input text1 text2 output\n"; print "input and output are paths to image input/output files\n"; print "requires imagemagick and inkscape\n"; exit 1; } my ($image, $text1, $text2, $output) = @ARGV; my ($owidth, $oheight) = split('x', (split(' ', `identify $image`))[2]); my $width = 800.; my $height = 800. * (1. * $oheight / $owidth); my $w = 110 + 110 + $width; my $wrect = 10 + 10 + $width; my $hrect = 10 + 10 + $height; my $wtext = 20 + 20 + $width; my $ytext1 = 70 + $height + 10; my $ytext2 = $ytext1 + 100; my $h = $ytext2 + 60; #TODO add big first and last letter, bar underneath, multiline $svg = < $text1 $text2 END my $tmp1 = `mktemp`; chop $tmp1; #TODO ugly open(F, "| inkscape /dev/stdin --export-png=/dev/stdout > $tmp1.png"); print F $svg; close (F); `convert $tmp1.png $output`