mirror of
http://git.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion/nihilist/blog-contributions.git
synced 2025-07-02 11:56:40 +00:00
add metadata-scrubbing tool
This commit is contained in:
parent
7dfe6893d2
commit
17dec95200
2 changed files with 43 additions and 0 deletions
23
nix/packages/metadata-scrub/default.nix
Normal file
23
nix/packages/metadata-scrub/default.nix
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
{
|
||||||
|
# Snowfall Lib provides a customized `lib` instance with access to your flake's library
|
||||||
|
# as well as the libraries available from your flake's inputs.
|
||||||
|
# You also have access to your flake's inputs.
|
||||||
|
|
||||||
|
# The namespace used for your flake, defaulting to "internal" if not set.
|
||||||
|
|
||||||
|
# All other arguments come from NixPkgs. You can use `pkgs` to pull packages or helpers
|
||||||
|
# programmatically or you may add the named attributes as arguments here.
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
pkgs.resholve.writeScriptBin "metadata-scrub" {
|
||||||
|
inputs = with pkgs; [
|
||||||
|
exiftool
|
||||||
|
toybox
|
||||||
|
];
|
||||||
|
execer = [
|
||||||
|
"cannot:${pkgs.exiftool}/bin/exiftool"
|
||||||
|
];
|
||||||
|
interpreter = "${pkgs.bash}/bin/bash";
|
||||||
|
} (builtins.readFile ./metadata-scrub.sh)
|
20
nix/packages/metadata-scrub/metadata-scrub.sh
Normal file
20
nix/packages/metadata-scrub/metadata-scrub.sh
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
|
||||||
|
# Check if a folder is provided
|
||||||
|
if [[ -z "$1" ]]; then
|
||||||
|
echo "Usage: $0 <folder>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
FOLDER="$1"
|
||||||
|
|
||||||
|
# Ensure the folder exists
|
||||||
|
if [[ ! -d "$FOLDER" ]]; then
|
||||||
|
echo "Error: Folder '$FOLDER' not found."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Recursively find and scrub metadata from all image files
|
||||||
|
find "$FOLDER" -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" -o -iname "*.gif" -o -iname "*.tiff" -o -iname "*.bmp" \) -exec exiftool -overwrite_original -all= {} \;
|
||||||
|
|
||||||
|
echo "✅ Metadata removed from all images in '$FOLDER'."
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue