The Herbarium Label Generator is a Python tool designed to create formatted herbarium labels from a iNaturalist and Mushroom Observer observations. This project rapidly creates professional quality labels for herbarium specimens. It is designed to be robust, work on many different platforms and handle errors or unexpected input gracefully.
An easy to use online version is at https://labels.dikarya.us
- Fetches observation data using the iNaturalist / Mushroom Observer API.
- Supports multiple iNat or MO observation IDs or URLs as input - or a file can be specified.
- Uses parallel processing, intelligent rate limiting, and advanced caching for reliable and fast label generation.
- Custom fields - you can include or exclude any label field with --custom
- Generates labels with key information including:
- Scientific Name (in italics)
- Common Name (if different from scientific name - disabled by default)
- iNaturalist / Mushroom Observer Observation Number
- iNaturalist / Mushroom Observer URL
- Location (in text format)
- Coordinates (with accuracy - accuracy is set to 20km if observation geoprivacy is obscured)
- Date Observed
- Observer Name and iNaturalist login
- Observation Notes (optional)
- The Species Name Override observation field overrides the scientific name
- The following observation fields are included on the labels if they are present in the observation: GenBank Accession Number GenBank Accession Provisional Species Name Microscopy Performed Fungal Microscopy Mobile or Traditional Photography? Herbarium Catalog Number Fungarium Catalog Number Herbarium Secondary Catalog Number Habitat Microhabitat Collection Number Collector's name Associated Species Herbarium Name Mycoportal ID Voucher Number Voucher Number(s) Mushroom Observer URL DNA Barcode ITS DNA Barcode LSU DNA Barcode RPB1 DNA Barcode RPB2 DNA Barcode TEF1
- Automatically sorts labels by observation number (or title field) for consistent ordering.
- Optional sort orders with
--sort:date(oldest first),date-desc(newest first),voucher,custom(with--sort-field FIELD), ornoneto keep input order. Date sorting uses the observation's API timestamp, including time of day, in the observation's own time zone. - Optional sequential numbering with
--number-labelsfor full-size labels. Numbers are assigned after sorting, with one number per distinct observation; the option is ignored for minilabels. - Support for "stack order" printing with
--stack-order, which reorders labels so they remain in order when the printed pages are cut and stacked (assumes 2 columns per page). The number of labels per page defaults to 6 and can be changed with--num-per-page(must be a positive even integer greater than 1). - Optimized PDF layout with narrow top/bottom margins and a wider center gap to simplify cutting and ensure uniform label sizes.
- By default outputs labels to console for quick viewing / testing
- Optionally creates RTF files for high-quality printing + QR code (RTF or PDF output is strongly recommended)
- Optionally creates PDF files for more compatibility
- Handles special characters and formatting (e.g., italics for scientific names, proper display of ± symbol)
- An optional command line switch can print out the iNaturalist URL's of observations which are in California. This makes it easy to add these observations to the Mycomap CA Network project.
- Adds a QR code to the PDF and RTF labels which points to the iNaturalist or Mushroom Observer URL
- When generating PDF or RTF labels it prints the iconic taxon along with the name - fungi in blue, plants in green and everything else in white. This will help you quickly notice if an observation number is mistyped.
- You can use the --no-qr command line argument to omit QR codes.
- You can use the --minilabel command line argument to make tiny labels that have only the observation # and QR code.
- BugGuide observation IDs are supported for minilabels (e.g.
BG2520730,BugGuide 2520730). - Per-label customization of which fields appear on the label via the
--customoption (add/remove default or observation fields without editing the code). - Fungus Fair Mode: Create display signage for fungus fairs using
--fungusfair. Uses a CSV file as input and puts edible/toxic images on the labels instead of a QR code.
Run the script from the command line, providing one or more iNaturalist observation IDs or URLs:
python inat.label.py <observation_number_or_url> [<observation_number_or_url> ...]To generate an RTF file, use the --rtf option:
python inat.label.py <observation_number_or_url> [<observation_number_or_url> ...] --rtf <filename.rtf>
To generate a PDF file, use the --pdf option:
python inat.label.py <observation_number_or_url> [<observation_number_or_url> ...] --pdf <filename.pdf>
To print out a list of URL's of observations that are in California, use the --find-ca option. This was added to make it easy to add observations to the Mycomap CA Network project. I paste the list of URL's into the Bulk URL Opener Chrome extension and add each tab to the project. If there is an easier way, I haven't found it yet.
python inat.label.py <observation_number_or_url> [<observation_number_or_url> ...] --find-ca
-
Generate label for a single observation:
python3 inat.label.py 183905751
-
Generate labels for multiple observations:
python3 inat.label.py 183905751 147249599 https://www.inaturalist.org/observations/106191917 MO505283
-
Generate labels and save to an RTF file:
python3 inat.label.py 183905751 147249599 --rtf two_labels.rtf
-
Generate fungus fair signage from a CSV file:
python3 inat.label.py --fungusfair fair.csv --pdf out.pdf
-
Generate labels with custom fields - in this case without Coordinates but with Fungusworld number
python3 inat.label.py 183905751 147249599 --custom "+Fungusworld, -Coordinates" --pdf out.pdf -
Generate labels in stack order (reordered for efficient cutting and stacking):
python3 inat.label.py 183905751 147249599 147249600 147249601 147249602 147249603 --pdf labels.pdf --stack-order -
Generate labels in stack order with 4 labels per page (2 columns of 2):
python3 inat.label.py 183905751 147249599 147249600 147249601 --pdf labels.pdf --stack-order --num-per-page 4
The script generates herbarium labels to the standard output by default, or labels are written to an RTF file if the --rtf command line argument is given. RTF labels look much more professional when printed and include QR codes - the standard output is mostly for testing.
- Python 3.10+
- requests
- requests-toolbelt
- python-dateutil
- beautifulsoup4
- qrcode[pil]
- colorama
- replace-accents
- pillow
- reportlab
Instead of installing this software, consider using the online version: https://labels.dikarya.us
-
Clone this repository:
git clone https://github.com/AlanRockefeller/inat.label.py
-
Navigate to the project directory:
cd inat.label.py -
Install the required dependencies:
pip install requests python-dateutil beautifulsoup4 qrcode[pil] colorama replace-accents pillow reportlab requests-toolbelt
Contributions to the iNaturalist Herbarium Label Generator are welcome! Here's how you can contribute:
- Fork the repository
- Create a new branch (
git checkout -b feature/AmazingFeature) - Make your changes
- Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Contact Alan Rockefeller via email, old fashioned phone call or messenger of your choice
Or just contact me with suggestions.
This project is licensed under the MIT License - see the LICENSE.md file for details.
Alan Rockefeller - My email address is my full name at gmail, or message me on Facebook, Linkedin or Instagram
Project Link: https://github.com/AlanRockefeller/inat.label.py