#!/usr/local/bin/perl # # Note: you may need to print to a page with no margins as my DVD cases # measure roughtly 7.25" x 11" and my printer cuts off the bounding box # on normal Letter printing. # use Text:Wrap to wrap the text for the front cover, which is narrower than the # spine of the DVD box. use Text::Wrap; $Text::Wrap::columns = 20; if (!@ARGV) { print "Usage: DVDcover.pl 'Text you want'\n\n"; exit(0); } $file = 'cover.gif'; # in case I want to make this a command line arg # geometry $w = 520; #522; width $h = 780; #792; height $ls = 15; # spacing above/below center for lines defining the spine area $line1 = $h/2 - $ls; $line2 = $h/2 + $ls; $title = $ARGV[0]; $title_front = wrap('','',$title); # wrap the text that goes on the front # pick a font, this is dependent on your system, the bottom is the most generic #$font = '/Library/Fonts/Papyrus.dfont -pointsize 36'; #$font = "Monaco -pointsize 18"; $font = "/System/Library/Fonts/Tahoma.ttf -pointsize 20"; #$font = "Times -pointsize 18"; # Note, some fonts shift the front cover text position. To compentsate, adjust the 100,150 values to relocate $CON = "/sw/bin/convert -fill white -strokewidth 18 -stroke black -font $font -size ".($w+10)."x".($h+10)." xc:white \\ -fill black -draw 'line 10,10 $w,10'\\ -fill black -draw 'line 10,10 10,$h'\\ -fill black -draw 'line $w,$h $w,10'\\ -fill black -draw 'line $w,$h 10,$h'\\ -fill black -draw 'line 10,$line1 $w,$line1'\\ -fill black -draw 'line 10,$line2 $w,$line2'\\ -fill black -pen black -draw \"gravity center text 0,-5 '$title'\" \\ -fill black -draw \"gravity west rotate 270 text 100,150 '$title_front'\" \\ $file"; #print "$CON\n"; system "$CON"; print "\nDone. Cover is in file: $file\nNote you may need to adjust print margins to print full cover.\n";