dumbfucks.org

Ol' Shirley's Buckets, with a watermark

my $filesList = `find /public/tobucket -maxdepth 1 -type f`;
my @filesToProc = split(/\n/, $filesList);
while(my $file = shift(@filesToProc)) {
my @filePath = split(/\//, $file);
my $fileName = pop(@filePath);
my @fileParts = split(/\./, $fileName);
my $fileBase = shift(@fileParts);
print "Processing $fileBase.\n";
# system("convert \"$file\" -trim -scale 972x1052! -fuzz 10\% -transparent white /tmp/1.png");
system("convert \"$file\" -trim -scale 972x1052 -fuzz 10\% -transparent white -fuzz 40\% -fill black -opaque \"#000000\" /tmp/1.png");
if (! -e '/public/craftycottage/watermarkbucket.png') {
system("convert \"/public/craftycottage/watermark.png\" -trim -scale 972x1052 /public/craftycottage/watermarkbucket.png");
}
my $newFileName = '/public/tobucket/done/' . $fileBase . '.png';
system("composite -gravity center -geometry +50-0 /tmp/1.png /public/butketblank.png \"$newFileName\"");
system("composite -gravity center -geometry +50-0 /public/craftycottage/watermarkbucket.png \"$newFileName\" \"$newFileName\"");
unlink($file);
}
unlink('/tmp/bucketrunning');
#