Greetings,
recently I've ran into a problem: I need to convert ppm (p3) to [insert image format supported by browsers] and back so that those 2 ppm's would be identical. So far I've found "convert in.ppm -compress none some.png && convert some.png -compress none out.ppm" to output least different ppm, but I need even more precision. Could anyone tell me how to achieve this?
Format, size of the image that ppm will be converted to doesn't matter as long as browsers support it.
ppm to png and back with least loss
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: ppm to png and back with least loss
As the PPM is the less sophisticated file format the results of a round trip through PNG should be quite good.
However PPM has a number of things defining that format that is not preserved by PNG. These include
http://www.imagemagick.org/Usage/formats/#netpbm
However PPM has a number of things defining that format that is not preserved by PNG. These include
- binary or text mode (-compression none for text)
- Gziped or not (add .gz suffix to output file)
- Multiple image sequence (just append the PPM files)
- depth the the PPM image. IM can read all depths, but can only output bit depths 8, 16 (rounding up)
There is a proposal to allow the specification of any depth for NetPbm formats. For example so you can output values in range say 0 to 99 (PPM depth 100) but no one has programmed the coder to do this.
http://www.imagemagick.org/Usage/formats/#netpbm
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/