I am using C++ API for Magick Image. Sometimes, when I use image.write("***.pgm"), it will write out a ascii format pgm. Is there a way that I can specify the Magick to write in raw(binary) format?
Thanks
How to save PGM in Raw(binary) format instead of ascii?
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
What compress did to you to select between P2 and P5 (text and binary) NetPBM formats?
At the moment I only mention the use of the "pnmnoraw" program, though direct Im control would be better.
See IM example notes on this format.
http://www.cit.gu.edu.au/~anthony/graph ... ts/#netpbm
use in creating simple images for Resized gradients...
http://www.cit.gu.edu.au/~anthony/graph ... ent_resize
and the last example for...
http://www.cit.gu.edu.au/~anthony/graph ... files/#txt
At the moment I only mention the use of the "pnmnoraw" program, though direct Im control would be better.
See IM example notes on this format.
http://www.cit.gu.edu.au/~anthony/graph ... ts/#netpbm
use in creating simple images for Resized gradients...
http://www.cit.gu.edu.au/~anthony/graph ... ent_resize
and the last example for...
http://www.cit.gu.edu.au/~anthony/graph ... files/#txt
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re:
I'm going to necrothread this (12 years!), but hopefully helpful to future googlers (or duckduckgo, or whatever is being used in 2031).
To go to TEXT (P2) mode, use "-compress None". Examples:
Code: Select all
convert input.png -compress None out.pgm
convert singlefile.pgm -compress None singlefile.pgm
Code: Select all
convert input.png +compress out.pgm
convert singlefile.pgm +compress singlefile.pgm
Specify +compress to store the binary image in an uncompressed format.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: How to save PGM in Raw(binary) format instead of ascii?
Yes it was added to IM Examples all those years ago...
PbmPlus / NetPBM Image File Format: PBM PGM PPM PNM PAM
http://www.imagemagick.org/Usage/formats/#pbmplus
PbmPlus / NetPBM Image File Format: PBM PGM PPM PNM PAM
http://www.imagemagick.org/Usage/formats/#pbmplus
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/