How to TImage::Open a PGM file?

From: OKUMURA, Akira <oxon_at_icrr.u-tokyo.ac.jp>
Date: Sat, 19 Mar 2005 00:11:55 +0900


Dear ROOTers,

(ROOT version 4.02/00 on Mac OS X 10.3.8)

When I try to open a PGM file using the function static TImage* TImage::Open(const char* file, TImage::EImageFileTypes type = kUnknown)
the PGM file seems to be opened as a PPM file. Because white to black gradations are converted to red to black gradations when they are 'Draw()'n.

Additionally, vertical noises often appear on the image. (Not always) The noises contains not only R but also G and B.

How can I open and draw PGM files correctly?

Here is a short test macro.

void test()
{

   TImage* img;
   TCanvas* c = new TCanvas("test", "test", 600, 600);

   for(int i=0; i<10; i++){

     img = TImage::Open("test.pgm", TImage::EImageFileTypes::kPnm);
     img->Draw();
     c->Update();

   }
}

Sincerely,

OKUMURA, Akira oxon_at_icrr.u-tokyo.ac.jp
Institute for Cosmic Ray Research, University of Tokyo 5-1-5 Kashiwanoha Kashiwa Chiba 277-8582 Japan Tel/Fax : +81 4-7136-3153
Skype : okumura.akira Received on Fri Mar 18 2005 - 16:13:07 MET

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:06 MET