Image PBM
Il existe deux catégories d'images PBM :
. un format ASCII : « ASCII »
codage 1 octet = 1 pixel (écriture directe dans un bloc-notes possible)
. un format binaire : « RAW »
codage 1 bit = 1 pixel
|
|
exemple au format ASCII |
| en-tête du Fichier |
signature du fichier
Pour les formats ASCII :
P1 = PBM bitmap
P2 = PGM greymap
P3 = PPM pixmap
Pour les formats Binaires :
P4 = PBM raw bitmap
P5 = PGM raw greymap
P6 = PPM raw pixmap
|
P1 |
| |
un séparateur = espace, Tab, LF ou CR |
[espace] |
| en-tête de l'image |
largeur de l’image en caractère ASCII |
5 |
| |
un séparateur |
[espace] |
| |
hauteur de l’image en caractère ASCII |
6 |
| |
un séparateur |
[espace] |
| Corps |
codage de chaque pixel ligne par ligne, en partant du coin haut-gauche
0 => blanc, 1 => noir
et un dernier 0 à la fin
|
0 0 1 0 0 0 1 0 1 0 0 1 1 1 0 1 0 0 0 1 1 0 0 0 1 0 |
- Exemple d'une image PBM en codage ASCII (à recopier simplement dans un bloc-notes avec l'extension .pbm):
P1 5 5 00100010100111010001100010