Click to See Complete Forum and Search --> : PPM file print


cheenu4
November 20th, 2003, 10:39 AM
I am using Redhat Linux and have a ppm file that I want to print from my code. Does anybody know which librarirs I need and what command I need to use in my C++ code fo rthat?

Thx

mirex
November 21st, 2003, 07:26 AM
If by PPM you mean PPM image file, then you can read it by yourself, PPM format is not too difficult. Here are specs:

start of file is text-like, contains 3 lines, for example:
P6
100 200
255
P6 is file identificator, it has to be like that.
100 & 200 are SizeX and SizeY of picture
255 is something that does not have to be changed.

After that binary data continue, 3 bytes (red green and blue, 0-255) for every pixel.

cheenu4
November 21st, 2003, 08:29 AM
Thanks for your help. It was ppm image file infact. However sending it to printer was an issue for several reasons like appropriate gamma correction. Ultimatelt, I am using pnmtops to convert it into post script file and then sending it tp lpr

system("ppmFile pnmtops | lpr)