      character*50 image, ofile
      character*80 line
      print *,'enter graytone image name:'
      read(5,100) image
  100 format(a)
c      print *,'enter number of pixels:'
c      read(5,*) ipix
c      print *,'enter number of scan lines:'
c      read(5,*) iscan
      l=len_trim(image)
      ofile=image(1:l)//'.lbl'
      open(10,file=ofile,form='formatted',status='old')
c      ofile=image(1:l)//'.dat'
      print *,'enter color image name:'
      read(5,100) image
      l=len_trim(image)
      ofile=image(1:l)//'.lbl'
      open(11,file=ofile,form='formatted',status='unknown')
      print *,'enter pallette file name:'
      read(5,100) ofile
   10 read(10,100,end=99) line
      if(line(1:11).eq.'PAL_POINTER') then
        write(11,101) ofile
      else if (line(1:15 ).eq.'PALETTE_POINTER') then
        write(11,102) ofile
      else
        l=len_trim(line)
        write(11,100) line(1:l)
      endif
      go to 10
  101 format(22hPAL_POINTER        = ',a,1h')
  102 format(22hPALETTE_POINTER    = ',a,1h')
   99 stop
      end


