Generate GMP-compliant barcodes for laboratory sample labeling in SVG and PNG formats with optional human‑readable text labels.
- Barcode types: Code128, Code39, EAN‑13
- Output formats: SVG (default) and PNG
- Add labels: print a line of text above the barcode (e.g., sample ID, lot number) directly into the image
- Adjustable: module width and quiet‑zone toggle
- High contrast black‑on‑white output for reliable scanning
- Rigorous input validation with clear error messages
- Lightweight dependencies: python‑barcode and Pillow
Clone the repository and install the dependencies:
git clone https://github.com/yourusername/lab-barcode-generator.git
cd lab-barcode-generator
pip install -r requirements.txt# Generate a Code128 barcode as SVG with a label
python run.py --text "SMPL-2026-001" --type code128 --output mylabel -f svg --label "Sample 001"
# Generate a PNG barcode with a smaller module width and no label
python run.py --text "123456789012" --type ean13 --output product_ean -f png --module-width 0.15 --no-quiet
# List supported barcode types
python -m lab_barcode_gen --list-typesRunning python run.py --help shows all options.
The tool produces crisp, high‑contrast images suitable for pharmaceutical and GMP environments where accurate sample identification is critical. The output is deterministic and reproducible for any given input.
MIT License – see LICENSE.