I was surfing on the internet when I came across this file called “PPM file” and its format! How to identify the PPM file? What exactly is this? What are its type?
I was surfing on the internet when I came across this file called “PPM file” and its format! How to identify the PPM file? What exactly is this? What are its type?
The PPM stands for the “Portable Pixel Map”. Ppm file consist of sequential order of ppm images. Image contains:
.
- Magic number to identify the type. This number is of two characters. That is P6.
- It also includes whitespace .
- It has height and width specified as ASCII character in decimal system.
- Maximum color value is specified in ASCII .It is 65536.
- Each pixel is a combination of red, green and blue digit.
- Each sample is in binary format.
- The above mentioned format is one type. It is called normal ppm file. Another type of it is plain format.
- Plain image contains:
- There is only one image.
- It has the magic number as P3.
- Each sample is in decimal format with White-space before and after it.
- It should have at-least one character space between two samples.
- No line has more than 70 characters.
If you have the PPM file then to check the file type do the following:
- Open the PPM file.
- On the first line find the two character (two byte)magic number!
- Now if the number you have found is P3 then it is PPM ASCII file. If it is P6 then it is PPM binary file.
Bookmarks