Search code examples
imageencodingppm

Why does my PPM image's body contain symbols?


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?


Solution

  • 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
    ...
    ...