From ef102f34e66206d1c55d2a7d509eef7f24059428 Mon Sep 17 00:00:00 2001 From: Leo Coogan Date: Tue, 25 Apr 2023 21:05:28 -0400 Subject: [PATCH] added back script, removed unnecessary script --- ffconv | 17 +++++++++++++++++ gpltopnm | 45 --------------------------------------------- 2 files changed, 17 insertions(+), 45 deletions(-) create mode 100755 ffconv delete mode 100755 gpltopnm diff --git a/ffconv b/ffconv new file mode 100755 index 0000000..4303bd8 --- /dev/null +++ b/ffconv @@ -0,0 +1,17 @@ +#!/bin/dash +#ffconv - Batch convert from one format to another +echo Convert from... +read ext +echo Convert to... +read toext + +for i in *.$ext; do ffmpeg -i "$i" "${i%.*}.$toext"; done + +while true; do + read -p "Delete original files? " yn + case $yn in + [Yy]* ) rm *.$ext; exit;; + [Nn]* ) exit;; + * ) printf "Please answer yes or no. ";; + esac +done diff --git a/gpltopnm b/gpltopnm deleted file mode 100755 index b1f1fd1..0000000 --- a/gpltopnm +++ /dev/null @@ -1,45 +0,0 @@ -#! /usr/bin/perl -w -use strict; -use List::Util qw[max]; - -# read a GIMP gpl palette file and write out a netpbm PPM image -# Liam Quin, https://www.delightfulcomputing.com/ 2021 - -my $inheader = 1; -my @colours; -my $max = 0; -while (<>) { - chomp; - if ($inheader) { - if (m/^GIMP Palette/) { - next; - } - if (m/^NameL/) { - next; - } - if (m/^#/) { - $inheader = 0; - next; - } - } elsif (m/^\s*(\d+)\s+(\d+)\s+(\d+).*$/) { - push @colours, [ $1, $2, $3 ]; - $max = max($max, $1, $2, $3); - } -} - -if (!@colours) { - die "$0: no colours found"; -} - -if ($max <= 0) { - die "$0: max value found is 0 which I think is an all-black palette"; -} - -# our image will be 1 pixel wide... -print "P3\n1 " . scalar(@colours) . "\n"; -print "${max}\n"; - -# now the image data -foreach (@colours) { - print $_->[0], " ", $_->[1], " ", $_->[2], "\n"; -}