Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/silasberger/netpbm-converter
- Owner: SilasBerger
- License: other
- Created: 2024-02-25T10:23:54.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-02-25T11:24:30.000Z (11 months ago)
- Last Synced: 2024-02-26T11:29:33.884Z (11 months ago)
- Topics: computer-science-education, education, encoding, image-encoder, image-encoding, informatikunterricht, netpbm
- Language: Python
- Homepage:
- Size: 246 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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