Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/silasberger/netpbm-converter

A command-line utility for converting images to Netpbm.
https://github.com/silasberger/netpbm-converter

computer-science-education education encoding image-encoder image-encoding informatikunterricht netpbm

Last synced: about 7 hours ago
JSON representation

A command-line utility for converting images to Netpbm.

Awesome Lists containing this project

README

        

# Netpbm Converter
A command-line utility for converting images to Netpbm.

## Usage
### Initial setup
```sh
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
```

### Converting an image
Command format: `convert.py `

**Usage examples:**
```sh
python convert.py P1 ./example_data/images/cat.jpg # creates ./example_data/images/cat.pbm (black & white)
python convert.py P2 ./example_data/images/dog.jpg # creates ./example_data/images/dog.pgm (grayscale)
python convert.py P3 ./example_data/images/capibara.jpg # creates ./example_data/images/capibara.ppm (full RGB)
```

## Features
### Supported Netpbm formats
| Type | Magic number | Extension | Colors |
|------------------|--------------|-----------|-----------------------|
| Portable BitMap | `P1` (ASCII) | `.pbm` | 0-1 (black & white) |
| Portable GrayMap | `P2` (ASCII) | `.pgm` | 0-255 (grayscale) |
| Portable PixMap | `P3` (ASCII) | `.ppm` | 0-255 per RGB channel |

### Limitations
- No support for magic numbers `P4` - `P6` (raw binary)
- No support for multibyte GrayMap

## Useful links
- [Netpbm (Wikipedia)](https://en.wikipedia.org/wiki/Netpbm)

## Image sources
- `cat.jpg`: JackieLou DL on Pixabay
- `dog.jpg`: Fran • @mallorcadogphotography on Pixabay
- `capibara.jpg`: Masakazu Kobayashi on Pixabay