blob: 124c23086943648e3c90287ed8c10fd7ef0f9b5b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#!/usr/bin/env raku
class Image {
has $.source;
has $.thumb;
has $.blur;
}
sub make-mrproper() {
}
sub make-thumb(IO::Path $image, Str :$thumb-dir) {
my $thumb = "$thumb-dir/{$image.basename}";
return if $thumb.IO.f;
}
sub make-thumbs(:@images, Str :$outdir) {
my $thumb-dir = "$outdir/thumbs";
mkdir $thumb-dir unless $thumb-dir.IO.d;
@images.hyper(batch => 10).map({ make-thumb $_, :$thumb-dir });
}
multi MAIN(
Bool :$mrproper, #= Clean output dir
Str :$indir = './indir', #= Input dir
Str :$outdir = './outdir', #= Output dir
) {
my @images = dir($indir, test => { "$indir/$_".IO.f });
make-mrproper if $mrproper;
mkdir $outdir unless $outdir.IO.d;
make-thumbs :@images, :$outdir;
}
|