I have recently learned how to read ppm3(P3) images in C++. I just read RGB pixels written in a plain format. I want to convert some certain jpg pictures to ppm3 and then experiment with different things, like identifying numbers there, the circled answers in exam papers, etc.
I have tried this website: https://convertio.co/pdf-ppm/, but it transformed a photo in the P6 format. Could anyone help?



You can use ImageMagick in the Terminal/shell:
If you omit
-compress noneyou'll get binary (i.e. P6) PPM output.If using old v6 ImageMagick, that becomes:
All the options, switches, operators and settings for ImageMagick are documented here.
If you want to convert PPM to JPEG, or to PNG, you can just use:
or
You can also programmatically create a random PPM file like this:
Then enlarge for easy viewing and make into a PNG:
Or, the same thing again, nut maybe slightly more elegantly and without creating an intermediate file:
If you prefer to use the lighter weight, but far less capable NetPBM tools, it would be: