A Kotlin implementation of NIST Biometric Image Software (NBIS) for reading, writing, and building NIST records. Compatible with any JVM language.
NBIS is a library implemented in Kotlin to extract, decode, build and write NIST compressed files. For more information about NIST Biometric Image Software, visit the official NIST page.
- ✅ Read NIST files from various input sources
- ✅ Write NIST files to output streams
- ✅ Build NIST files programmatically
- ✅ Support for record types 1-17
- ✅ JVM language compatibility (Java, Kotlin, Scala, etc.)
- ✅ Comprehensive field access and manipulation
| Record Type | Description | Read | Write | Build |
|---|---|---|---|---|
| 1 | Transaction Information Record | ✅ | ✅ | ✅ |
| 2 | User-defined descriptive text | ✅ | ✅ | ✅ |
| 3 | Low-resolution grayscale fingerprint image | ✅ | ✅ | ✅ |
| 4 | High-resolution grayscale fingerprint image | ✅ | ✅ | ✅ |
| 5 | Low-resolution binary fingerprint image | ✅ | ✅ | ✅ |
| 6 | High-resolution binary fingerprint image | ✅ | ✅ | ✅ |
| 7 | User-defined image | ✅ | ✅ | ✅ |
| 8 | Signature image | ✅ | ✅ | ✅ |
| 9 | Minutiae data (for fingerprints) | ✅ | ✅ | ✅ |
| 10 | Facial and SMT image | ✅ | ✅ | ✅ |
| 11 | Forensic and investigatory voice data | ✅ | ✅ | ✅ |
| 12 | Forensic dental and oral data | ✅ | ✅ | ✅ |
| 13 | Variable-resolution latent friction ridge image | ✅ | ✅ | ✅ |
| 14 | Variable-resolution fingerprint image | ✅ | ✅ | ✅ |
| 15 | Palm print image | ✅ | ✅ | ✅ |
| 16 | User-defined variable-resolution test image | ✅ | ✅ | ✅ |
| 17 | Iris image | ✅ | ✅ | ✅ |
| 18 | DNA data | ❌ | ❌ | ❌ |
| 19 | Plantar (footprint) image | ❌ | ❌ | ❌ |
| 20 | Original image record | ❌ | ❌ | ❌ |
<dependency>
<groupId>eu.aagsolutions.img</groupId>
<artifactId>nbis</artifactId>
<version>0.7.1</version>
</dependency>implementation 'eu.aagsolutions.img:nbis:0.7.1'implementation("eu.aagsolutions.img:nbis:0.7.1")val nistFile = NistFileReader(inputStream).use { reader -> reader.read() }
val transactionInformationRecord = nistFile.getTransactionInformationRecord()try (NistFileReader reader = new NistFileReader(inputStream)) {
NistFile nistFile = reader.read();
TransactionInformationRecord transactionInformationRecord = nistFile.getTransactionInformationRecord();
}val nistFile = NistFileReader.Companion.decode(byteArray)
val transactionInformationRecord = nistFile.getTransactionInformationRecord()NistFile nistFile = NistFileReader.Companion.decode(byteArray);
TransactionInformationRecord transactionInformationRecord = nistFile.getTransactionInformationRecord();NistFileWriter(FileOutputStream("output.nist")).use { writer -> writer.write(nistFile) }NistFile nistFile = new NistFileBuilder()
.withTransactionInformationRecord(transactionInformationRecord)
.withUserDefinedDescriptionTextRecords(userDefinedTextRecord)
.withFacialAndSmtImageRecords(facialAndSMTImageRecord)
.build();
try (NistFileWriter writer = new NistFileWriter(new FileOutputStream("output.nist"))) {
writer.write(nistFile);
}The main container for NIST records.
Key Methods:
getTransactionInformationRecord()- Get the required Type 1 recordgetRecordsByType(RecordType)- Get all records of a specific typegetRecordByTypeAndIdc(RecordType, Int)- Get a specific record by type and IDCgetAllRecords()- Get all records in the file
Reads NIST files from input streams.
Writes NIST files to output streams.
Programmatically builds NIST files.
// Get field as text
val idcValue = record.getFieldText(DefaultFields.IDC)
// Get binary data (for image records)
val imageData = record.getBinaryData()
// Get specific field object
val field = record.getField(DefaultFields.LEN)All record types extend BaseRecord and provide type-specific functionality:
TransactionInformationRecord- Type 1 recordsUserDefinedTextRecord- Type 2 recordsHighResolutionGrayscaleFingerprintRecord- Type 4 recordsMinutiaeDataRecord- Type 9 records- And more...
The library supports different field types:
TextField- Text-based fieldsImageField- Binary image data fields
- Java: 17 or higher
- Kotlin: 2.1 or higher
This project was inspired by the need for a robust and efficient library for handling NIST biometric image files. The inspiration comes from the original NBIS library, which is written in C and has been widely used in the biometric community. The goal of this project is to provide a modern, Kotlin-based alternative that is easier to use and maintain.
The project also draws inspiration from the work of other developers who have contributed to the open-source community with similar libraries. By leveraging their work and building upon it, we aim to create a high-quality, reliable, and efficient library for working with NIST biometric image files: