ǷFxCٲ;yF..." /> ǷFxCٲ;yF..." /> ǷFxCٲ;yF..."/>

Why does my PPM image's body contain symbols?

622 views Asked by At

My PPM image contains the following :

P6

1200

670

255

ܒNԪjɝ[؋Cц:̈6y5"r-¼,ֈ?Ԛ_݈׵̻֬كڕÒɪxڇՄmxɘl܊؇euί\jĩqÿHqAʻK΃PùG9EʁM͂M΂O̿PɼLȀMǃOǁLƾH»D5A®>ǷFxCٲ;yFƾIǿJʀL»GڲAʂWǯŐĕх՜џᔡ嚪矱Ԫׄ࠘ĝц׶Qfһψ΅e{ڈڗÖܻԡȜׂӐ}˸_hؖ`­u؛dьWЋV̓MͺHυPƽF˂I߼>ٹ6}>س5>Eiuƻ1

and 40000 more lines of illegible code. Is this an encoding issue?

2

There are 2 answers

0
Mark Setchell On BEST ANSWER

If you want it in ASCII P3 format, you can use ImageMagick, which is in most Linux distros and available for OSX and Windows,iike this

convert yourFile.ppm -compress none output.ppm

Then it will look like this:

P3
70 46
255
48 47 45 50 48 46 54 50 47 56 51 46 58 51 45 57 50 45 56 48 45 57 49 46
56 48 45 56 48 45 55 47 44 53 45 42 52 44 41 53 45 42 53 45 42 49 45 39
49 46 39 52 49 42 55 52 45 57 54 47 63 58 47 70 63 51 74 66 52 76 65 50
...
...
3
Harald K On

No, this is completely normal for a mode P6 PPM.

In this mode, only the header is ASCII, the pixels are written as binary data, 8 or 16 bits per sample, pixel interleaved.

It's also possible to have PPM in "plain" or ASCII format, this mode uses P3 as its identifier.

See the PPM spec for more info.