summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2022-04-06 01:21:18 +0100
committerPaul Buetow <paul@buetow.org>2022-04-06 01:21:18 +0100
commit3f9e6db036cecbd7dcc02dc5f0a85527c276d71e (patch)
treedd4aa510ae7582e5a48ce249d85d45af1d12a63c
parent42bdc543643d0b3fb01a5e374edf040dd43c2664 (diff)
initial sword
-rw-r--r--README.md4
-rwxr-xr-xslice.raku34
2 files changed, 37 insertions, 1 deletions
diff --git a/README.md b/README.md
index 95b2540..0ebc5d3 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,5 @@
# katana
-Static photo album generator for my personal street photography site at https://irregular.ninja programmed in the Raku programming language. \ No newline at end of file
+This is the static photo album generator for my personal street photography site at https://irregular.ninja programmed in the Raku programming language.
+
+*CAUTION*: Still wip!
diff --git a/slice.raku b/slice.raku
new file mode 100755
index 0000000..124c230
--- /dev/null
+++ b/slice.raku
@@ -0,0 +1,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;
+}