+sub dimensions ($imgpath) {
+ require IPC::Run;
+ IPC::Run::run(
+ [identify => -format => '%w %h', $$imgpath],
+ '<' => \undef, '>&' => \my $xy
+ ) or die ["Image dimensions could not be determined.", $$imgpath];
+ return split /\s/, $xy, 3;
+}
+
+sub generate ($imgpath, $thumbpath, $opt) {