PRO rawtopgm,imagename ; ; This procedure creates a Portable Graymap file from a specified ; Polar Camera image. The PGM file created has the same name as ; the input PoCa image file, with '.pgm' appended to the end. The ; image file header is written in byte form as comments below the ; comment line giving the original file name. ; rdkimg,imagename,headbytes,image KIh=gethd(headbytes) width=KIh.sys.ccd.cols/KIh.exp.sbin height=KIh.sys.ccd.rows/KIh.exp.pbin maxval=2^KIh.sys.data_bits pgmname=imagename+'.pgm' OPENW,unit,pgmname,/GET_LUN PRINTF,unit,'P2' ; portable graymap "magic number" PRINTF,unit,'# '+pgmname ; portable graymap file name PRINTF,unit,headbytes,FORMAT='("# ",16I4)' PRINTF,unit,width PRINTF,unit,height PRINTF,unit,maxval PRINTF,unit,image,FORMAT='(10I6)' CLOSE,unit FREE_LUN,unit RETURN END