I recently finished the raytracing tutorial "Ray Tracing in One Weekend", which outputs to PPM. I'm trying to convert to PNG to share my results, but all the solutions I've tried have thrown errors.
When using FFMPEG with ffmpeg -i image.ppm out.png
I get the following errors:
[image2 @ 0000020a3ef7a200] decoding for stream 0 failed
[image2 @ 0000020a3ef7a200] Could not find codec parameters for stream 0 (Video: ppm, none): unspecified size
Error while decoding stream #0:0: Invalid data found when processing input
Cannot determine format of input stream 0:0 after EOF
Error marking filters as finished
I tried adjusting the analyzeduration and probesize options to no effect.
When using ImageMagick with magick image.ppm out.png
I get the following error:
magick: improper image header `image.ppm' @ error/pnm.c/ReadPNMImage/343.
(I've also tried online converters, but they all throw unhelpful errors as well.)
Most of the PPM viewers I've tried have no issue opening the input image, so corruption/bad data is unlikely. Edit: GIMP seems to have trouble opening it, and online viewers are 50/50. Image format is P3, are some programs only able to do P4-P6?
ffmpeg version N-90884-g19c3df0cd6 Copyright (c) 2000-2018 the FFmpeg developers
Seems like the problem is with generatedppm
file. You can tryXNview MP
, it can open (and convert) many image formats