Skip to content

ctx-0/scripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Scripts

ExifTool

View metadata

exiftool file.jpg
exiftool path/to/dir/

Strip metadata

By default, exiftool creates a backup of the original with an _original suffix (e.g. file.jpg_original).

exiftool -all= -o output/dir/ input/dir/
exiftool -all= -overwrite_original input/dir/

Recursive

exiftool -all= -r path/to/dir/

On errors, exiftool skips the problematic file, reports it, and continues. A summary at the end shows how many files were processed and how many failed. With -o, failed files are simply absent from the output folder — originals are never affected.

Redirect errors to a log file

exiftool -all= -r path/to/dir/ 2>errors.log

ffmpeg

# 2x speed - makes 10 second video into 5 seconds
ffmpeg -i twitter_video.mp4 -vf "setpts=0.5*PTS,fps=10,scale=480:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 output_2x.gif

# 4x speed - makes 10 second video into 2.5 seconds
ffmpeg -i twitter_video.mp4 -vf "setpts=0.25*PTS,fps=10,scale=480:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 output_4x.gif

./remove_bg.py

Removes backgrounds from all images in a directory using rembg (U2Net model via ONNX Runtime). Outputs PNG files to preserve transparency. The model (~170MB) is downloaded automatically on first run.

CPU (default) — works out of the box, no extra setup, slower on large batches

pip install rembg[cpu]

GPU — significantly faster, requires an NVIDIA GPU with CUDA 12 and cuBLAS.

pip install rembg[gpu]

usage: remove_bg.py [-h] [--dry-run] input_dir output_dir

# Preview without processing
python remove_bg.py --dry-run input/dir/ output/dir/

# Process
python remove_bg.py input/dir/ output/dir/

Supported formats: jpg, jpeg, png, webp, bmp, tiff.

./rename_files.py

Renames all files in a directory to random UUIDs, preserving extensions.

usage: rename_files.py [-h] [--dry-run] [-y] directory


# Preview without renaming
python rename_files.py --dry-run path/to/dir/

# Rename with confirmation prompt
python rename_files.py path/to/dir/

About

personal scripts, snippets

Resources

Stars

Watchers

Forks

Contributors

Languages