A simple command-line tool that converts code snippets into beautifully syntax-highlighted images.
Quick Shot captures specific lines of code from any file and generates a professional-looking image with syntax highlighting. Perfect for sharing code in presentations, documentation, or social media. The tool supports multiple syntax highlighting styles and automatically detects the programming language.
- 📸 Convert code snippets to images with syntax highlighting
- 🎨 Multiple color schemes (or choose a random style)
- 📝 Select specific line ranges from your files
- 🔤 Automatic language detection based on file extension
- 📊 Line numbers included in the generated image
- Clone or download this repository
- Navigate to the project directory
- Create a virtual environment:
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate
- Install the package:
pip install -e .
Run the main script:
python main.pyYou'll be prompted to provide:
- File name: Path to the file containing the code
- Line range: Which lines to capture (e.g.,
5-12or just8for a single line) - Style: Syntax highlighting theme (default:
monokai, or typerandomfor a random style)
The tool will generate code_snippet.png in your working directory.
Enter the name of the file to be screenshot: main.py
Enter line range (e.g. 5-12 or 8): 10-25
Enter the style to use (by default we us monokai, or say random to choose a random style): monokai
Capturing lines 10-25 from main.py
Saved to code_snippet.png
MIT License