+use lib $0 =~ s{[^/]+$}{..}r; # project root
+use Shiar_Sheet::ImagePrep '1.03';
+
+our $VERSION = '1.00';
+
+my %opt;
+
+if (@ARGV and $ARGV[0] =~ /^-/) {
+ require Getopt::Long;
+ Getopt::Long->import(qw( 2.33 :config gnu_getopt ));
+ GetOptions(\%opt,
+ 'jpg=s',
+ 'webp=s',
+ ) or exit 64;
+}
+
+%opt or %opt = (
+ jpg => '300x200',
+ webp => '630x420@30',
+);
+
+my @ffs;
+for (keys %opt) {
+ push @ffs, my $ff = [$_];
+ my $r = $opt{$_};
+ push @{$ff}, -quality => $1 if $r =~ s/@(\d+)//;
+ push @{$ff}, -resize => !/\dx\d+$/ ? $_ : ("$_^", -extent => $_)
+ for split / /, $r;
+}
+
+my $target = '..';
+$target = pop @ARGV if @ARGV >= 2 and -d $ARGV[-1];