dttt
A versatile command-line toolkit providing various utility functions.
Installation
go install git.bits.studio/public/dttt@latest
Or clone the repository and build it manually:
git clone git.bits.studio/public/dttt
cd dttt
go build -o dttt
Commands
resize
Resize images to a specified width while maintaining aspect ratio.
# Single file resize
dttt resize [input_file] [output_file] [width]
# Batch resize all images in a directory
dttt resize [input_directory] [output_directory] [width] --batch
The command supports multiple image formats (JPG, PNG, WebP) and preserves the original file format.
Options:
--batch, -b: Enable batch resizing mode for directories--quality, -q: Quality for lossy formats (1-100, default: 90)--extensions, -e: Comma-separated list of file extensions to process in batch mode (default: jpg,jpeg,png,webp)
Examples:
# Resize a single image
dttt resize input.jpg output.jpg 800
# Resize a single image with custom quality
dttt resize input.webp output.webp 1200 --quality 85
# Batch resize all images in a directory to 1000px width
dttt resize ./photos ./resized 1000 --batch
# Batch resize only JPG and PNG files
dttt resize ./originals ./thumbnails 400 --batch --extensions jpg,png
convert
Convert images between different formats including JPG, PNG, and WebP.
# Single file conversion
dttt convert [input_file] [output_file]
# Batch conversion
dttt convert [input_directory] [output_directory] --batch --format [format]
The output format is determined by the output file extension (for single file conversion) or the --format flag (for batch conversion).
Options:
--quality, -q: Quality for lossy formats (1-100, default: 90)--batch, -b: Enable batch conversion mode--format, -f: Output format for batch conversion (jpg, jpeg, png, webp)--extensions, -e: Comma-separated list of file extensions to process in batch mode (default: jpg,jpeg,png,webp)
Examples:
# Convert single JPG to WebP
dttt convert input.jpg output.webp
# Convert PNG to JPG with 80% quality
dttt convert input.png output.jpg --quality 80
# Convert WebP to PNG
dttt convert input.webp output.png
# Batch convert all JPG and PNG files in a directory to WebP
dttt convert ./photos ./webp_photos --batch --format webp --extensions jpg,png
# Batch convert all supported images to JPG with 85% quality
dttt convert ./input ./output --batch --format jpg --quality 85
favicon
Generate a complete favicon package from a single image source, similar to favicon.io.
dttt favicon [input_image] [output_dir] [flags]
This creates all common favicon formats and sizes required for modern websites, including:
- PNG favicons in various sizes (16x16, 32x32, 48x48 and more)
- Apple Touch Icons for iOS devices
- Android/PWA icons for Android and Progressive Web Apps
- Web app manifest and browserconfig files
- HTML snippet for easy inclusion in your website
Options:
--name, -n: Application name for the web manifest (default: "App")--short-name, -s: Short application name for the web manifest (default: "App")
Examples:
# Basic usage
dttt favicon logo.png ./favicons
# With custom application name
dttt favicon logo.png ./favicons --name "My Awesome Website" --short-name "MyApp"
The command generates all the necessary favicon files in the output directory, ready to be used in your website. Modern browsers support PNG favicons, so an .ico file is not needed anymore.
rename
Rename files in bulk based on specified patterns.
dttt rename --pattern "prefix_###.jpg" --start 1 --directory ./images
Options:
--directory, -d: Directory containing the files to rename (default: current directory)--pattern, -p: Pattern for renaming files. Use '###' as a placeholder for numeric sequence--start, -s: Start index for numeric sequence in the renaming pattern (default: 1)
server
Start a simple HTTP server to serve files from a specified directory.
dttt server [directory]
Options:
--port, -p: Port number for the HTTP server (default: 8080)
If no directory is provided, the current directory is used.
chat
Start a chat server or connect to other peers.
# Start a chat server
dttt chat
# Connect to a chat server
dttt chat localhost:8080
Options:
--nickname, -n: Nickname for the user
env
Manage environment variables.
# List all environment variables
dttt env list
# Set an environment variable
dttt env set KEY VALUE
# Unset an environment variable
dttt env unset KEY
Configuration
You can specify a configuration file using the --config flag. By default, the configuration is read from $HOME/.dttt.yaml.
License
See the LICENSE file for details.