atiksoftware / Portable-Viewer

An application that displays and converts PGM (Portable Gray Map), PPM (Portable Pixmap), and PBM (Portable Bitmap) images.
MIT License
2 stars 1 forks source link

can not open these pnm #1

Open Charltsing opened 1 year ago

Charltsing commented 1 year ago

2JohnC1V3.zip

atiksoftware commented 1 year ago

@Charltsing sory for late. your file is 2JohnC1V3.ppm start with

P6
707  
441  
255

it should be

2 Byte magic
width - height
max value

like:

P6
707 441  
255
Charltsing commented 1 year ago

https://netpbm.sourceforge.net/doc/ https://netpbm.sourceforge.net/doc/ppm.html

A "magic number" for identifying the file type. A ppm image's magic number is the two characters "P6". Whitespace (blanks, TABs, CRs, LFs). A width, formatted as ASCII characters in decimal. Whitespace. A height, again in ASCII decimal. Whitespace.

Whitespace not only blanks, ,but also TABs, CRs, LFs

Charltsing commented 1 year ago

PPM、PGM、PBM "white space" character is space, CR, LF, TAB, VT, or FF (I.e. what the ANSI standard C isspace() function calls white space).

PAM Header Each line ends with and is delimited by a newline character. an example header:

P7 WIDTH 227 HEIGHT 149 DEPTH 3 MAXVAL 255 TUPLTYPE RGB ENDHDR

atiksoftware commented 1 year ago

@Charltsing its updated